Add validation for Plexus-based plugin dependency injection - #12649
Open
slawekjaranowski wants to merge 2 commits into
Open
Add validation for Plexus-based plugin dependency injection#12649slawekjaranowski wants to merge 2 commits into
slawekjaranowski wants to merge 2 commits into
Conversation
* Add validation for Plexus-based plugin dependency injection What changed - Added a new validation that detects outdated dependency injection usage in plugins. - Added a clear warning for plugin developers when this pattern is found. - Pointed users to the recommended modern injection approach. (cherry picked from commit 2a8b6b2)
gnodet
approved these changes
Jul 31, 2026
gnodet
left a comment
Contributor
There was a problem hiding this comment.
Clean cherry-pick of the already-merged PR #12577 from master to the maven-4.0.x branch. The new PluginDescriptorRequirementsValidator correctly detects legacy Plexus @Component requirements in plugin descriptors and emits a non-blocking validation warning via IssueLocality.EXTERNAL. Fits naturally into the existing MavenPluginConfigurationValidator framework.
A couple of very minor observations (non-blocking):
- The
pluginValidationManagerfield isprotectedbut the class is a package-private concrete@Singleton—privatewould be slightly more precise since this can't be meaningfully subclassed. - A
@sinceJavadoc tag (as used inDeprecatedCoreExpressionValidatorandPlexusContainerDefaultDependenciesValidator) would help future maintainers identify when this validation was introduced.
Tests cover both the positive and negative paths. No backwards-compatibility risk. LGTM.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of gnodet
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.
What changed
(cherry picked from commit 2a8b6b2)