dev@glassfish.java.net

Don't assign older version to newer maven artifacts

From: Sanjeeb Sahoo <sahoo_at_sun.com>
Date: Thu, 24 Jun 2010 22:07:21 +0530

I have noticed that we are sometimes unintentionally assigning an older
maven version to a newer artifact. This typically happens to artifacts
that are built outside of GlassFish workspace, as we don't have a review
mechanism in place for them. We come to know about them when they get
integrated in GlassFish, but that's too late as the artifact is already
published in maven repo by that time. _The pattern that I have observed
is that we are assigning a version like 1.2.3.1 thinking it is higher
than 1.2.3_. Please don't apply common sense when it comes to maven
version comparison. Refer to [1] to see how unintutive the comparison
rules are. e.g., *1.1.1.1 < 1.1.1*.

If you want to experiment around the version scheme, PFA a program that
uses Maven API to either compare two versions or show details about
individual version components depending on how many arguments you pass
to it. The source code is also there in the jar.
e.g.:
>java -jar maven-version.jar 3.2.1.1 3.2.1
-3
3.2.1.1 is less than 3.2.1

>java -jar maven-version.jar 3.2.1.1
major = 0, minor = 0, micro = 0, qualifier = 3.2.1.1, buildNumber = 0

Thanks,
Sahoo

[1] http://docs.codehaus.org/display/MAVEN/Versioning