Skip to content

Add validation for Plexus-based plugin dependency injection - #12577

Open
slawekjaranowski wants to merge 2 commits into
apache:masterfrom
slawekjaranowski:desc-requirements
Open

Add validation for Plexus-based plugin dependency injection#12577
slawekjaranowski wants to merge 2 commits into
apache:masterfrom
slawekjaranowski:desc-requirements

Conversation

@slawekjaranowski

@slawekjaranowski slawekjaranowski commented Jul 28, 2026

Copy link
Copy Markdown
Member

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.

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.
@slawekjaranowski slawekjaranowski self-assigned this Jul 28, 2026
@slawekjaranowski slawekjaranowski added the enhancement New feature or request label Jul 28, 2026
@slawekjaranowski

Copy link
Copy Markdown
Member Author

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two issues in this warning message:

  1. {@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.

  2. 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:

Suggested change
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.");

gnodet added a commit to gnodet/maven that referenced this pull request Jul 28, 2026
gnodet added a commit to gnodet/maven that referenced this pull request Jul 28, 2026
@slawekjaranowski
slawekjaranowski requested a review from gnodet July 28, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants