You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Example ordering
new ComparableVersion("NotAVersionSting"),
new ComparableVersion("1.0a1-SNAPSHOT"),
new ComparableVersion("1.0-alpha1"),
new ComparableVersion("1.0beta1-SNAPSHOT"),
new ComparableVersion("1.0-b2"),
new ComparableVersion("1.0-beta3.SNAPSHOT"),
new ComparableVersion("1.0-beta3"),
new ComparableVersion("1.0-milestone1-SNAPSHOT"),
new ComparableVersion("1.0-m2"),
new ComparableVersion("1.0-rc1-SNAPSHOT"),
new ComparableVersion("1.0-cr1"),
new ComparableVersion("1.0-SNAPSHOT"),
new ComparableVersion("1.0"),
new ComparableVersion("1.0-sp"),
new ComparableVersion("1.0-a"),
new ComparableVersion("1.0-RELEASE"),
new ComparableVersion("1.0-whatever"),
new ComparableVersion("1.0.z"),
new ComparableVersion("1.0.1"),
new ComparableVersion("1.0.1.0.0.0.0.0.0.0.0.0.0.0.1")
Equal versions
assertEquals(new ComparableVersion("1.0-alpha1"), new ComparableVersion("1.0-a1"));
assertEquals(new ComparableVersion("1.0-beta1"), new ComparableVersion("1.0-b1"));
assertEquals(new ComparableVersion("1.0-milestone1"), new ComparableVersion("1.0-m1"));
assertEquals(new ComparableVersion("1.0-rc1"), new ComparableVersion("1.0-cr1"));
assertEquals(new ComparableVersion("1.0-ga"), new ComparableVersion("1.0"));
assertEquals(new ComparableVersion("1.0-final"), new ComparableVersion("1.0"));
All qualifiers are case insensitive, as this test demonstrates:
assertEquals(new ComparableVersion("1.0ALPHA1"), new ComparableVersion("1.0-a1"));
assertEquals(new ComparableVersion("1.0Alpha1"), new ComparableVersion("1.0-a1"));
assertEquals(new ComparableVersion("1.0AlphA1"), new ComparableVersion("1.0-a1"));
assertEquals(new ComparableVersion("1.0BETA1"), new ComparableVersion("1.0-b1"));
assertEquals(new ComparableVersion("1.0MILESTONE1"), new ComparableVersion("1.0-m1"));
assertEquals(new ComparableVersion("1.0RC1"), new ComparableVersion("1.0-cr1"));
assertEquals(new ComparableVersion("1.0GA"), new ComparableVersion("1.0"));
assertEquals(new ComparableVersion("1.0FINAL"), new ComparableVersion("1.0"));
assertEquals(new ComparableVersion("1.0-SNAPSHOT"), new ComparableVersion("1-snapshot"));
Where version strings can not be parsed as major.minor.patch.build and the qualifier is not recognized, the entire string is considered a qualifier. These qualifiers are then compared as case insensitive strings:
assertTrue(new ComparableVersion("SomeRandomVersionOne").compareTo(
new ComparableVersion("SOMERANDOMVERSIONTWO")) < 0);
assertTrue(new ComparableVersion("SomeRandomVersionThree").compareTo(
new ComparableVersion("SOMERANDOMVERSIONTWO")) < 0);
The text was updated successfully, but these errors were encountered:
amazimbe
changed the title
Update Gradle version code to use version code in dependabot common
Update Gradle version to use semver 2 version in dependabot common
Aug 12, 2024
amazimbe
changed the title
Update Gradle version to use semver 2 version in dependabot common
Update Maven version to use semver 2 version in dependabot common
Aug 13, 2024
amazimbe
changed the title
Update Maven version to use semver 2 version in dependabot common
Update maven version to use maven standard
Aug 19, 2024
Maven version spec to be implemented: https://maven.apache.org/pom.html#version-order-specification
https://github.com/apache/maven/blob/master/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java
Example ordering
new ComparableVersion("NotAVersionSting"),
new ComparableVersion("1.0a1-SNAPSHOT"),
new ComparableVersion("1.0-alpha1"),
new ComparableVersion("1.0beta1-SNAPSHOT"),
new ComparableVersion("1.0-b2"),
new ComparableVersion("1.0-beta3.SNAPSHOT"),
new ComparableVersion("1.0-beta3"),
new ComparableVersion("1.0-milestone1-SNAPSHOT"),
new ComparableVersion("1.0-m2"),
new ComparableVersion("1.0-rc1-SNAPSHOT"),
new ComparableVersion("1.0-cr1"),
new ComparableVersion("1.0-SNAPSHOT"),
new ComparableVersion("1.0"),
new ComparableVersion("1.0-sp"),
new ComparableVersion("1.0-a"),
new ComparableVersion("1.0-RELEASE"),
new ComparableVersion("1.0-whatever"),
new ComparableVersion("1.0.z"),
new ComparableVersion("1.0.1"),
new ComparableVersion("1.0.1.0.0.0.0.0.0.0.0.0.0.0.1")
Equal versions
assertEquals(new ComparableVersion("1.0-alpha1"), new ComparableVersion("1.0-a1"));
assertEquals(new ComparableVersion("1.0-beta1"), new ComparableVersion("1.0-b1"));
assertEquals(new ComparableVersion("1.0-milestone1"), new ComparableVersion("1.0-m1"));
assertEquals(new ComparableVersion("1.0-rc1"), new ComparableVersion("1.0-cr1"));
assertEquals(new ComparableVersion("1.0-ga"), new ComparableVersion("1.0"));
assertEquals(new ComparableVersion("1.0-final"), new ComparableVersion("1.0"));
All qualifiers are case insensitive, as this test demonstrates:
Where version strings can not be parsed as major.minor.patch.build and the qualifier is not recognized, the entire string is considered a qualifier. These qualifiers are then compared as case insensitive strings:
The text was updated successfully, but these errors were encountered: