I maintain an open source project and publish its releases to The Central Repository. I just published oshi-core-2.6
. The versioning in my pom.xml
fo
This is a job for a classifier and not for that kind of weird version.
Furthermore the referenced document of Oracle was valid for Maven 2 but not for Maven 3.
Apart from that I would suggest to increase the major version for such incombatible change based on semver.
Furthermore you are referencing the ComparableVersion with alpha etc. is how Maven internally handles the versions. This can looked at the Unit test for that class.
But you can check the behaviour of Maven via a little command line tool:
java -jar apache-maven-3.3.9\lib\maven-artifact-3.3.9.jar 1.0.0 2.0.0
Display parameters as parsed by Maven (in canonical form) and comparison result:
1. 1.0.0 == 1
1.0.0 < 2.0.0
2. 2.0.0 == 2
By using this you can see that Maven 3+ handles 2.6-m-java7
as greater than 2.6
.
java -jar apache-maven-3.3.9\lib\maven-artifact-3.3.9.jar 2.6-m-java7 2.6
Display parameters as parsed by Maven (in canonical form) and comparison result:
1. 2.6-m-java7 == 2.6-m-java-7
2.6-m-java7 > 2.6
2. 2.6 == 2.6
So this is the reason why central also handles it as greater.
So if you use things like rc
or alpha
you will see the result:
java -jar apache-maven-3.3.9\lib\maven-artifact-3.3.9.jar 2.6-alpha 2.6
Display parameters as parsed by Maven (in canonical form) and comparison result:
1. 2.6-alpha == 2.6-alpha
2.6-alpha < 2.6
2. 2.6 == 2.6
java -jar apache-maven-3.3.9\lib\maven-artifact-3.3.9.jar 2.6-rc1 2.6
Display parameters as parsed by Maven (in canonical form) and comparison result:
1. 2.6-rc1 == 2.6-rc-1
2.6-rc1 < 2.6
2. 2.6 == 2.6
(The above CLI tool is available since Maven 3.2.5).
The best solution is to have a module which produces your usual artifact. Making a supplemental module which contains the configuration for JDK 7 and there you can use "threeten backport" and create an other artifact. Those artifacts should have classifiers for such purposes.