ComparableVersion

35 views
Skip to first unread message

Andrzej Jarmoniuk

unread,
Oct 7, 2022, 3:53:50 PM10/7/22
to mojohaus-dev
Hi all,

I'm quite new to Maven and Maven plugins, but have recently been quite active. Today, a bug report was raised to versions-maven-plugin, where a user claims that the plugin's logic doesn't correspond Maven versioning policy. And the user might be right.


Apparently, non-standard qualifiers aren't being considered as less mature than releases without any qualifiers, which as far as I know, conflicts with the version policy, which states that any qualified version should be deemed less mature.

Case in question: version 2.3-pfd is consider an update to 2.3.

Responsible class: ComparableVersion, which is being used by all version comparators in the plugin, but the class has also been imported to maven proper, and apparently is being used there too for comparing versions. I've checked. Made a small unit test using the Maven class which confirms my suspicion.

ComparableVersion actually contains a bespoke list of qualifiers which it considers as making the version *older* than the release, but there are also some which make the version newer (?):

/**
* A comparable for the empty-string qualifier. This one is used to determine if a given qualifier makes the
* version older than one without a qualifier, or more recent.
*/
private static final Comparable<String> RELEASE_VERSION_INDEX = String.valueOf( QUALIFIERS_LIST.indexOf( "" ) );

My question is then: is this really a bug or is it a feature of the versioning system?

Best regards
Andrzej

mc.p...@gmail.com

unread,
Oct 8, 2022, 5:57:49 AM10/8/22
to mojohaus-dev


Op vrijdag 7 oktober 2022 om 21:53:50 UTC+2 schreef Andrzej Jarmoniuk:

Apparently, non-standard qualifiers aren't being considered as less mature than releases without any qualifiers, which as far as I know, conflicts with the version policy, which states that any qualified version should be deemed less mature.

 

Andrzej Jarmoniuk

unread,
Oct 8, 2022, 6:28:29 AM10/8/22
to mojohaus-dev
I don't question that. All I say is that the current implementation is not in line with the spec.

Or do you mean to say that the version containing an unknown qualifier is considered newer than a release version?


Op zaterdag 8 oktober 2022 om 11:57:49 UTC+2 schreef mc.p...@gmail.com:
Reply all
Reply to author
Forward
0 new messages