[MNG-5974] ComparableVersion fails with semver.org-style milestone versions
- Dominant language
- Java
- Stars
- 5.3k
- Forks
- 3.1k
- Avg merge
- 20h 42m
- Merged PRs (30d)
- 297
Description
**[Tuure Laurinolli](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=tulau)** opened **[MNG-5974](https://issues.apache.org/jira/browse/MNG-5974?redirect=false)** and commented
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:
```
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);
}
}
```
---
**Affects:** 3.3.9, 3.8.4
**Issue Links:**
- [MNG-6064](https://issues.apache.org/jira/browse/MNG-6064) Add "dev" string item into ComparableVersion
- [MNG-6568](https://issues.apache.org/jira/browse/MNG-6568) ComparableVersion breaks Comparable contract for some triples
0 votes, 6 watchers
Contributor guide
Assessment
This issue has not been assessed yet.