Can maven handle special qualifiers?

I am trying to find out if the Maven policy is on custom qualifiers. I know that there are certain qualifiers in versions that maven checks, for example:

1.0.0-SNapshot

5.3.0-beta-5

etc., but I was wondering if I could write specific rules or something that could handle special qualifiers, for example:

1.0.0-mybranch

5.3.0-myotherbranch

or how maven will deal with such string versions. I tried them and everything looks fine, I'm just wondering if Maven has some kind of user logic that can be used.

Thanks!

+6
source share
2 answers

These examples will work fine.

Qualifiers have no special meaning, except:

  • SNAPSHOT, which translates to the correct tag / assembly number
  • the only numerical values ​​that are actually the build number instead of the qualifier (and are considered newer than the corresponding base version).

All qualifiers are considered older than the associated release, i.e. 1,2-beta-1, 1.2

Qualifier comparisons are performed as string comparisons. This behavior may differ in Maven 2.x and Maven 3.x (in the first, 1.0-beta-10 <1.0-beta-5, in the latter case it behaves the other way around, as one would expect).

+7
source

The 2011 answer is now outdated in many important details. See the Javadoc at https://maven.apache.org/ref/3.3.9/maven-artifact/apidocs/org/apache/maven/artifact/versioning/ComparableVersion.html and the Wiki link for the current version processing logic.

cf How are maven sort version numbers?

+2
source

Source: https://habr.com/ru/post/895102/


All Articles