You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Tuure Laurinolli (Jira)" <ji...@apache.org> on 2022/01/10 08:09:00 UTC

[jira] [Comment Edited] (MNG-5974) ComparableVersion fails with semver.org-style milestone versions

    [ https://issues.apache.org/jira/browse/MNG-5974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17471745#comment-17471745 ] 

Tuure Laurinolli edited comment on MNG-5974 at 1/10/22, 8:08 AM:
-----------------------------------------------------------------

Valid in what sense?

The description is accurate for 3.3.9.
It reproduces with maven-artifact 3.8.4 as well:
{code}
java -jar .\maven-artifact-3.8.4.jar 1.2.3-m.2 1.2.3-rc.1
Display parameters as parsed by Maven (in canonical form and as a list of tokens) and comparison result:
1. 1.2.3-m.2 -> 1.2.3-m.2; tokens: [1, 2, 3, [m, 2]]
   1.2.3-m.2 > 1.2.3-rc.1
2. 1.2.3-rc.1 -> 1.2.3-rc.1; tokens: [1, 2, 3, [rc, 1]]
{code}

That is milestone 2 is considered newer than rc 1.



was (Author: tulau):
Valid in what sense?

The description is accurate for 3.3.9.
It reproduces with mavena-artifact 3.8.4 as well:
{code}
java -jar .\maven-artifact-3.8.4.jar 1.2.3-m.2 1.2.3-rc.1
Display parameters as parsed by Maven (in canonical form and as a list of tokens) and comparison result:
1. 1.2.3-m.2 -> 1.2.3-m.2; tokens: [1, 2, 3, [m, 2]]
   1.2.3-m.2 > 1.2.3-rc.1
2. 1.2.3-rc.1 -> 1.2.3-rc.1; tokens: [1, 2, 3, [rc, 1]]
{code}

That is milestone 2 is considered newer than rc 1.


> ComparableVersion fails with semver.org-style milestone versions
> ----------------------------------------------------------------
>
>                 Key: MNG-5974
>                 URL: https://issues.apache.org/jira/browse/MNG-5974
>             Project: Maven
>          Issue Type: Bug
>          Components: Artifacts and Repositories
>    Affects Versions: 3.3.9
>            Reporter: Tuure Laurinolli
>            Priority: Major
>             Fix For: waiting-for-feedback
>
>
> ComparableVersion does not correctly parse semver.org-style milestone versions where the "m" is separated from the milestyne number by a dot, like "1.0.0-m.3".
> It seems that Maven only recognizes the "m" alias for "milestone" if it's immediately followed by a digit. I don't think this is according to the class javadoc, which does not mention that some aliases require the alias to be followed by a number to be effective.
> Test case:
> {code}
> import org.apache.maven.artifact.versioning.ComparableVersion;
> import org.junit.Test;
> import static org.junit.Assert.assertTrue;
> public class VersionTest {
>     @Test
>     public void testSortVersions() throws Exception {
>         final ComparableVersion m2 = new ComparableVersion("1.2.3-m.2");
>         final ComparableVersion rc1 = new ComparableVersion("1.2.3-rc.1");
>         assertTrue(rc1.compareTo(m2) > 0);
>     }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)