Fix #393: stop reading LATEST from the deprecated Artifact constant - #424
Merged
elharo merged 2 commits intoAug 20, 2026
Merged
Conversation
…tant getAetherArtifact() filled in a missing version from org.apache.maven.artifact.Artifact.LATEST_VERSION, which Maven 4 deprecates, and that import was the only thing the class used it for. The value stays "LATEST", now a private constant. Passing null instead, as the issue suggests, would not work: Aether's DefaultArtifact normalises a null version to the empty string, so two-part coordinates would resolve against g:a:pom: rather than the newest version. Adds a test for the coordinate parsing, which had none.
elharo
requested changes
Aug 19, 2026
Contributor
Author
|
Both addressed — the constant is inlined at the use site, and the licence box is ticked. Ready for another look when you have a moment @elharo. |
elharo
approved these changes
Aug 19, 2026
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 |
Contributor
Author
|
On the All 147 source files in the repo carry the |
elharo
approved these changes
Aug 20, 2026
elharo
left a comment
Contributor
There was a problem hiding this comment.
OK< we need to fix spotless then but not in this PR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #393.
getAetherArtifact()filled in a missing version fromorg.apache.maven.artifact.Artifact.LATEST_VERSION, which Maven 4 deprecates. That import was the only use of the class, so it goes too. The value stays"LATEST", now a private constant on the mojo.One thing on the issue's suggested replacement: null does not work here. Aether normalises it to the empty string, not to a metaversion.
(checked against maven-resolver-api 2.0.21). The result goes straight into
readArtifactDescriptorandresolveArtifact, so an empty version would makehelp:effective-pom -Dartifact=groupId:artifactIdlook forg:a:pom:instead of the newest release.getAetherArtifacthad no tests, so this adds four covering the two-part and three-part forms and the two rejection paths. The metaversion assertion uses the literal rather than the constant, so it still fails if the value changes.mvn testis 30 passing, spotless clean.