Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-5974

ComparableVersion fails with semver.org-style milestone versions

    XMLWordPrintableJSON

    Details

      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:

      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);
          }
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                tulau Tuure Laurinolli
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: