Skip to content

[Backport maven-4.0.x] Fix #13459: support package-private configuration classes in plugins - #13685

Merged
gnodet merged 1 commit into
apache:maven-4.0.xfrom
gnodet:backport/13470-to-maven-4.0.x
Oct 22, 2026
Merged

gnodet merged 1 commit into
apache:maven-4.0.xfrom
gnodet:backport/13470-to-maven-4.0.x

Conversation

@gnodet

@gnodet gnodet commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #13470 to maven-4.0.x.

Cherry-pick of d560929 applied cleanly.

Changes:

  • Override instantiateObject() in EnhancedConfigurationConverter.fromConfiguration() with a local instantiate() method that uses getDeclaredConstructor() + setAccessible(true), allowing package-private configuration classes (and inner classes) to be used as @Parameter types in Maven 4 API plugins
  • Add regression test for package-private constructor instantiation

Fixes #13459

@gnodet gnodet self-assigned this Oct 22, 2026
@gnodet gnodet added enhancement New feature or request mvn4 labels Oct 22, 2026
@gnodet gnodet added this to the 4.0.0 milestone Oct 22, 2026
@gnodet gnodet changed the title [backport maven-4.0.x] Fix #13459: support package-private configuration classes in plugins [Backport maven-4.0.x] Fix #13459: support package-private configuration classes in plugins Oct 22, 2026

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

LGTM. Clean cherry-pick of #13470 — the fix correctly replaces the inherited plexus instantiateObject() (which uses Class.newInstance() requiring public constructors) with a local instantiate() that uses getDeclaredConstructor() + conditional setAccessible(true), properly supporting package-private configuration classes. All reflection failures are caught and wrapped in ComponentConfigurationException. CI green on all platforms / JDKs.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@gnodet
gnodet merged commit 17c5312 into apache:maven-4.0.x Oct 22, 2026
25 checks passed
@gnodet
gnodet deleted the backport/13470-to-maven-4.0.x branch October 26, 2026 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport enhancement New feature or request mvn4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants