[
https://issues.apache.org/jira/browse/MNG-7559?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17694966#comment-17694966
]
ASF GitHub Bot commented on MNG-7559:
-------------------------------------
Thomas-Bergmann commented on code in PR #929:
URL: https://github.com/apache/maven/pull/929#discussion_r1121421815
##########
maven-artifact/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionTest.java:
##########
@@ -346,4 +342,22 @@ public void testReuse() {
assertEquals(c1, c2, "reused instance should be equivalent to new
instance");
}
+
+ /**
+ * Test <a
href="https://issues.apache.org/jira/browse/MNG-7559">MNG-7559</a> edge cases
+ * 1.0.0.RC1 < 1.0.0-RC2
+ * -pfd < final, ga, release
+ * 2.0.1.MR < 2.0.1
+ * 9.4.1.jre16 > 9.4.1.jre16-preview
+ */
+ @Test
+ public void testMng7559() {
+ checkVersionsOrder("1.0.0.RC1", "1.0.0-RC2");
+ checkVersionsOrder("4.0.0.Beta3", "4.0.0-RC2");
+ checkVersionsOrder("2.3-pfd", "2.3");
+ checkVersionsOrder("2.0.1.MR", "2.0.1");
+ checkVersionsOrder("9.4.1.jre16-preview", "9.4.1.jre16");
+ checkVersionsEqual("2.0.a", "2.0.0.a"); // previously ordered, now
equals
+ checkVersionsOrder("1-sp-1", "1-ga-1"); // proving website
documentation right.
Review Comment:
According to the test `checkVersionsOrder("9.4.1.jre16-preview",
"9.4.1.jre16");`
Is there a feature wish to support "filters" inside the version extension
like "jre\d+"? I assume, the specification of version number must be adapted
for that, because it's not the idea of "jre17" is later or better than a "jdk8"
release. It's just the same release for another platform.
So semantically, `checkVersionsEqual("9.4.1.jre16", "9.4.1.jre8");` and the
result to get a new version depends on the current selected.
> ComparableVersion vs versions with custom qualifiers
> ----------------------------------------------------
>
> Key: MNG-7559
> URL: https://issues.apache.org/jira/browse/MNG-7559
> Project: Maven
> Issue Type: Bug
> Affects Versions: 3.8.3
> Reporter: Andrzej Jarmoniuk
> Priority: Major
> Fix For: 4.x / Backlog
>
> Attachments: image-2022-10-22-18-22-11-591.png
>
>
> Since I know that ComparableVersion was brought to Maven from
> versions-maven-plugin, it turns out the bug described here:
> https://github.com/mojohaus/versions-maven-plugin/issues/744
> also exists in maven, at least in 3.8.3.
> According to the maven version spec, versions containing a qualifier should
> be treated as less major than the same versions without the qualifier.
> Currently it's only the case for a few "standard" qualifiers, e.g. "-rc*",
> "-alpha", etc.
> However, it looks like "2.3-pfd" is deemed less major than "2.3".
> {code:java}
> @Test
> public void testComparableVersionWithCustomQualifier()
> {
> assertThat( new ComparableVersion( "2.3" ).compareTo( new
> ComparableVersion( "2.3-pfd" ) ),
> greaterThan( 0 ) );
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)