Skip to content

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

Open
slawekjaranowski wants to merge 2 commits into
apache:maven-4.0.xfrom
slawekjaranowski:cp-12577
Open

Add validation for Plexus-based plugin dependency injection#12649
slawekjaranowski wants to merge 2 commits into
apache:maven-4.0.xfrom
slawekjaranowski:cp-12577

Conversation

@slawekjaranowski

Copy link
Copy Markdown
Member
  • 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)

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

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

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 pluginValidationManager field is protected but the class is a package-private concrete @Singletonprivate would be slightly more precise since this can't be meaningfully subclassed.
  • A @since Javadoc tag (as used in DeprecatedCoreExpressionValidator and PlexusContainerDefaultDependenciesValidator) 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

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