Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Duplicate
-
2.2.1
-
None
-
None
Description
Hi all,
Currently, Maven fails to properly resolve dependencies while version follow this pattern :
[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9][alpha|beta|rc][0-9][0-9]
e.g.
1.0.0-alpha-2
1.0.0-alpha-10
1.0.0-beta-3
etc.
As described in following link
http://www.sonatype.com/books/maven-book/reference/pom-relationships-sect-pom-syntax.html
One gotcha for release version numbers is the ordering of the qualifiers. Take the version release numbers "1.2.3-alpha-2" and "1.2.3-alpha-10", where the "alpha-2" build corresponds to the 2nd alpha build, and the "alpha-10" build corresponds to the 10th alpha build. Even though "alpha-10" should be considered more recent than "alpha-2", Maven is going to sort "alpha-10" before "alpha-2" due to a known issue in the way Maven handles version numbers.
Maven is supposed to treat the number after the qualifier as a build number. In other words, the qualifier should be "alpha", and the build number should be 2. Even though Maven has been designed to separate the build number from the qualifier, this parsing is currently broken. As a result, "alpha-2" and "alpha-10" are compared using a String comparison, and "alpha-10" comes before "alpha-2" alphabetically. To get around this limitation, you will need to left-pad your qualified build numbers. If you use "alpha-02" and "alpha-10" this problem will go away, and it will continue to work once Maven properly parses the version build number.
Is it possible to add a new feature enabling to customize the way Maven compares version resolution?
Adding for example a regular expression pattern.
Kind regards,
Aziz
Attachments
Issue Links
- duplicates
-
MNG-3010 Problem parsing version ranges
- Closed