Home > Blockchain >  How does ${awsjavasdk.version} work in POM
How does ${awsjavasdk.version} work in POM

Time:02-17

Some SDK in Maven has a POM file, with dependencies like this:

<dependencies>
  <dependency>
    <groupId>software.amazon.awssdk</groupId>
    <artifactId>aws-json-protocol</artifactId>
    <version>${awsjavasdk.version}</version>
  </dependency>
<dependencies>

However unlike normal maven variable, ${awsjavasdk.version} is not defined in the POM file.

How is the value is given to the version?

Example pom file https://repo1.maven.org/maven2/software/amazon/awssdk/cognitoidentity/2.17.99/cognitoidentity-2.17.99.pom

CodePudding user response:

From the parent!

The mentioned POM has a parent:

<parent>
    <groupId>software.amazon.awssdk</groupId>
    <artifactId>services</artifactId>
    <version>2.17.99</version>
</parent>

This parent can be found at https://repo1.maven.org/maven2/software/amazon/awssdk/services/2.17.99/services-2.17.99.pom.

The POM there has itself a parent:

<parent>
    <groupId>software.amazon.awssdk</groupId>
    <artifactId>aws-sdk-java-pom</artifactId>
    <version>2.17.99</version>
</parent>

This in turn can be found at https://repo1.maven.org/maven2/software/amazon/awssdk/aws-sdk-java-pom/2.17.99/aws-sdk-java-pom-2.17.99.pom.

And this parent has a large list of properties, among them is your asked value:

<properties>
    <awsjavasdk.version>${project.version}</awsjavasdk.version>
    ...
</properties>
  • Related