GeezerVison is showing github.com — Fix #393: stop reading LATEST from the deprecated Artifact constant by kratos0718 · Pull Request #424 · apache/maven-help-plugin
Conversation
kratos0718
commented
Aug 19, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Fixes #393.
getAetherArtifact() filled in a missing version from org.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.
new DefaultArtifact("g", "a", "jar", (String) null).getVersion() // ""
new DefaultArtifact("g", "a", "jar", "LATEST").getVersion() // "LATEST"
(checked against maven-resolver-api 2.0.21). The result goes straight into readArtifactDescriptor and resolveArtifact, so an empty version would make help:effective-pom -Dartifact=groupId:artifactId look for g:a:pom: instead of the newest release.
getAetherArtifact had 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 test is 30 passing, spotless clean.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
* "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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
On the https note — I tried it and spotless rejects it. The licence header is a fixed template in the build, so changing the scheme fails the check and spotless:apply rewrites it straight back:
[ERROR] The following files had format violations:
[ERROR] src/test/java/org/apache/maven/plugins/help/AbstractHelpMojoTest.java
[ERROR] -·*···https://www.apache.org/licenses/LICENSE-2.0
[ERROR] +·*···http://www.apache.org/licenses/LICENSE-2.0
All 147 source files in the repo carry the http form, so this one matches. Changing it looks like a spotless config change rather than something to do in this PR — happy to raise it separately if you want it moved.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK< we need to fix spotless then but not in this PR
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
elharo
elharo approved these changes
Uh oh!
There was an error while loading. Please reload this page.
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.
|