Reputation: 546
Having declared the master POM for a project using version ranges resolves to the latest version (containing SNAPSHOT). Any way to make it resolve to release ?
Parent POM declaration inside project :
<parent>
<groupId>my.company</groupId>
<artifactId>my-company-pom</artifactId>
<version>(,2.0.0]</version>
</parent>
Parent POM metadata file
<metadata>
<groupId>my.company</groupId>
<artifactId>my-company-pom</artifactId>
<version>1.0.1</version>
<versioning>
<latest>1.3.0-SNAPSHOT</latest>
<release>1.2.0</release>
<versions>
<version>1.0.0</version>
<version>1.0.1-SNAPSHOT</version>
<version>1.0.1</version>
<version>1.1.0</version>
<version>1.2.0</version>
<version>1.3.0-SNAPSHOT</version>
</versions>
<lastUpdated>xxxxxxxxxxxx</lastUpdated>
</versioning>
</metadata>
Why Maven resolves parent POM version to 1.3.0-SNAPSHOT instead of 1.2.0 ?
Upvotes: 2
Views: 662
Reputation: 44965
As you can see here, it is a very old, well known and controversy bug in maven for me your best option is not to use version range in your case at all as there is no real valid workaround.
Upvotes: 1
Reputation: 5185
You can exclude snapshot versions in a custom repository definition to solve this issue.
<repositories>
<repository>
<id>codehaus</id>
<name>codehaus</name>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>http://snapshots.maven.codehaus.org/maven2</url>
<layout>default</layout>
</repository>
</repositories>
Maven just does not "see" snapshots then. Of course you have to adapt the settings (URL and so on) to your repo.
Upvotes: 0
Reputation: 52516
Because you set 1.3.0-SNAPSHOT
is the latest, in this line (6th line in parent pom metadata XML file)
<latest>1.3.0-SNAPSHOT</latest>
Upvotes: 0