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

MavenDependency#findNewerVersion - unnecessary downloads, edge cases #5062

Open
nmck257 opened this issue Feb 18, 2025 · 1 comment
Open
Labels
bug Something isn't working

Comments

@nmck257
Copy link
Collaborator

nmck257 commented Feb 18, 2025

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
@nmck257 nmck257 added the bug Something isn't working label Feb 18, 2025
@sambsnyd
Copy link
Member

I'm always happy for dependency resolution performance to be improved!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

2 participants