Skip to content

MavenDependency#findNewerVersion - unnecessary downloads, edge cases #5062

Open
@nmck257

Description

Just recording a few quirks / opportunities in MavenDependency's findNewerVersions method:

  • Overall, this method checks Maven metadata first and then compares version numbers after; it could probably save some HTTP traffic if it first checked whether the VersionComparator is even able to yield a "newer version" compared to the currentVersion and early-exited if not
    • Imagine a new canUpgrade(String currentVersion) method on VersionComparator which would (eg) return false if the current version is 3.0.0 and the version comparator is based on 2.1.x
  • Looking at the ExactVersion edge case which handles incomplete Maven metadata: I think this line is an obscure error, and it should be comparing if the exact version is an upgrade of the current version instead of returning it unconditionally: https://github.com/openrewrite/rewrite/blame/05795eb525099812887796b5d0a73eda6d7f6673/rewrite-maven/src/main/java/org/openrewrite/maven/trait/MavenDependency.java#L103

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    • Status

      No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions