[
https://issues.apache.org/jira/browse/MNG-5974?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tuure Laurinolli updated MNG-5974:
----------------------------------
Description:
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}
was:
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}
> 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
>
> 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
(v6.3.4#6332)