Add validation for Plexus-based plugin dependency injection - #12577
Add validation for Plexus-based plugin dependency injection#12577slawekjaranowski wants to merge 2 commits into
Conversation
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.
|
as continuation for: |
gnodet
left a comment
There was a problem hiding this comment.
Two minor issues confirmed in the warning message string — the validation logic and test coverage look solid.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of gnodet
| PluginValidationManager.IssueLocality.EXTERNAL, | ||
| mavenSession, | ||
| mojoDescriptor, | ||
| mojoClass, |
There was a problem hiding this comment.
Two issues in this warning message:
-
{@code @Component}is Javadoc syntax — inside a Java string literal it will render literally as{@code @Component}in console output, not@Component. All other validators in this package (e.g.PlexusContainerDefaultDependenciesValidator,Maven3CompatDependenciesValidator) use plain text in their runtime messages. -
Grammar: "Plugin use" should be "Plugin uses" (subject-verb agreement). The second clause is also awkward — "Maven 4 DI ... to inject dependencies should be used instead".
Suggested rewrite:
| mojoClass, | |
| "Plugin uses Plexus Component requirements (@Component annotation). " | |
| + "Use Maven 4 Dependency Injection (for v4 plugins) or JSR 330 annotations (for v3 plugins) to inject dependencies instead."); |
What changed