GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

@kratos0718 kratos0718 commented Aug 19, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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.


  • I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@kratos0718
Fix apache#393: stop reading LATEST from the deprecated Artifact cons…
63a8c03
…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
elharo requested changes Aug 19, 2026
View reviewed changes

@elharo elharo left a comment

Copy link
Copy Markdown
Contributor

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.

license not agreed to

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/main/java/org/apache/maven/plugins/help/AbstractHelpMojo.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@kratos0718
Inline the LATEST literal instead of a single-use constant
039baa8
@kratos0718

kratos0718 commented Aug 19, 2026

Copy link
Copy Markdown
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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

elharo
elharo approved these changes Aug 19, 2026
View reviewed changes
Comment thread src/test/java/org/apache/maven/plugins/help/AbstractHelpMojoTest.java
* "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

@elharo elharo Aug 19, 2026

Copy link
Copy Markdown
Contributor

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.

https

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@kratos0718

kratos0718 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

elharo
elharo approved these changes Aug 20, 2026
View reviewed changes

@elharo elharo left a comment

Copy link
Copy Markdown
Contributor

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.

All reactions
@elharo
elharo merged commit 2dbc5ee into apache:master Aug 20, 2026
17 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@elharo elharo added the maintenance label Aug 20, 2026
@github-actions github-actions Bot assigned elharo Aug 20, 2026
@github-actions github-actions Bot added this to the 3.5.3 milestone Aug 20, 2026
@slawekjaranowski slawekjaranowski mentioned this pull request Nov 17, 2026
Planned releases — Q4 2026 (Doxia stack + plugins + shared deps) apache/maven#13085
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@elharo elharo elharo approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@elharo elharo

Labels

maintenance

Projects

None yet

Milestone

3.6.0

Development

Successfully merging this pull request may close these issues.

AbstractHelpMojo.getAetherArtifact() uses deprecated Artifact.LATEST_VERSION

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@kratos0718 @elharo
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.