Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement maven standard for dependency versions #10382

Closed
amazimbe opened this issue Aug 7, 2024 · 0 comments
Closed

Implement maven standard for dependency versions #10382

amazimbe opened this issue Aug 7, 2024 · 0 comments
Assignees
Labels
L: java:maven Maven packages via Maven

Comments

@amazimbe
Copy link
Contributor

amazimbe commented Aug 7, 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:

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);
@amazimbe amazimbe self-assigned this Aug 7, 2024
@amazimbe amazimbe converted this from a draft issue Aug 7, 2024
@amazimbe amazimbe moved this from Ready to In Progress in Dependabot Aug 9, 2024
@amazimbe 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 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 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
@github-actions github-actions bot added the L: java:maven Maven packages via Maven label Aug 20, 2024
@abdulapopoola abdulapopoola moved this from In Progress to In review in Dependabot Aug 23, 2024
@amazimbe amazimbe moved this from In Progress to In review in Dependabot Sep 4, 2024
@amazimbe amazimbe changed the title Update maven version to use maven standard Implement maven standard for dependency versions Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: java:maven Maven packages via Maven
Projects
Archived in project
Development

No branches or pull requests

1 participant