Repository navigation
Fix deprecated Maven testing API compatibility - #12683
Conversation
Honor the deprecated Basedir annotation in MojoExtension and restore the legacy ProducedArtifactStub constructor. Add regression coverage for deprecated annotation injection and constructor source compatibility.
gnodet
left a comment
There was a problem hiding this comment.
Correct, well-scoped fix for issue #12678. The findBasedirValue method follows the exact pattern already established by findInjectMojoAttrs and isRealSession for handling deprecated annotation fallback. The ProducedArtifactStub constructor restoration is also correct. Both changes have targeted regression tests.
Minor note (out of scope for this PR): The same missing-constructor issue exists in the deprecated ArtifactStub shim and in the deprecated SessionStub shim — these represent the same class of bug but are separate fixes.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of gnodet
gnodet
left a comment
There was a problem hiding this comment.
Review: Fix deprecated Maven testing API compatibility
Clean, well-scoped compatibility fix that restores deprecated annotation handling for @Basedir and adds the missing 5-arg constructor to the deprecated ProducedArtifactStub shim. Follows the exact pattern already used for @InjectMojo, @MojoTest, and @MojoParameter deprecated fallbacks. All CI checks pass.
The new findBasedirValue method correctly follows the established precedence pattern: check new annotation first, fall back to deprecated annotation, return null/default if neither is found. Test coverage is good — testDeprecatedAnnotations exercises all three deprecated annotations together.
This review was generated by an AI agent (Claude Code) and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of Guillaume Nodet
Summary
org.apache.maven.api.plugin.testing.Basedirannotation while preserving precedence for the replacement annotationProducedArtifactStubcompatibility classThis keeps the deprecated testing API functional for its remaining lifetime instead of allowing existing plugin tests to compile but silently use the wrong base directory.
Fixes #12678.
Verification
mvn --batch-mode verifymvn --batch-mode -pl impl/maven-testing -am verifymvn --batch-mode -pl impl/maven-testing -am -rf :maven-testing -Dtest=ExpressionEvaluatorTest,ProducedArtifactStubTest -Dsurefire.failIfNoSpecifiedTests=false testFollowing this checklist to help us incorporate your
contribution quickly and easily:
Note that commits might be squashed by a maintainer on merge.
This may not always be possible but is a best-practice.
mvn verifyto make sure basic checks pass.A more thorough check will be performed on your pull request automatically.
If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.