Skip to content

Forward port Maven 3.10.0 PluginDependenciesResolver changes - #12329

Merged
cstamas merged 4 commits into
apache:masterfrom
cstamas:forward-port-plugin-dep-resolver
Jun 22, 2026
Merged

cstamas merged 4 commits into
apache:masterfrom
cstamas:forward-port-plugin-dep-resolver

Conversation

@cstamas

@cstamas cstamas commented Jun 19, 2026

Copy link
Copy Markdown
Member

Also, restore binary compatibility that was broken in 4-beta-2.

This PR aligns PluginDependenciesResolver with changes happened in Maven 3.10.x, and also restores binary incompatibility happened in DefaultPluginDependenciesResolver that used to be injected directly.

Also, restore binary compatibility that was broken in 4-beta-2.

This PR aligns PluginDependenciesResolver with changes happened
in Maven 3.10.x, and also restores binary incompatibility happened
in DefaultPluginDependenciesResolver that used to be injected
directly.
@cstamas cstamas added this to the 4.1.0 milestone Jun 19, 2026
@cstamas cstamas self-assigned this Jun 19, 2026
@cstamas
cstamas marked this pull request as ready for review June 19, 2026 11:23
@cstamas

cstamas commented Jun 19, 2026

Copy link
Copy Markdown
Member Author

@gnodet master is broken with this same error

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

Nice work aligning the Maven 4.x PluginDependenciesResolver with the 3.10.x changes and restoring the binary compatibility broken in 4-beta-2. The deprecation+delegation pattern is correctly applied, and switching to interface-based injection in BootstrapCoreExtensionManager is the right move.

A couple more observations not tied to specific lines:

  • TODO comment: Both BootstrapCoreExtensionManager files (compat and impl) have a TODO comment above the call site that still references resolveCoreExtension. Since the method is now resolveCoreExtensionAndFlatten and the method is now on the interface, the TODO may be partially addressed and could be refined.
  • @since 3.10.0 on new interface methods: The new methods use @since 3.10.0, which correctly references where they originated, but since Maven 4.x and 3.10.x are separate release lines, consumers reading the Maven 4.x javadoc might find this confusing. Flagging for awareness only.
  • No tests added: No new or modified tests, which is reasonable for an interface evolution / binary compat PR where the behavior is unchanged (new methods delegate to the same resolveInternal logic).

This review does not replace specialized AI review tools (CodeRabbit, Sourcery) or static analysis (SonarCloud).

Fully automatic review from Claude Code

* @param session The repository session to use for resolving the plugin artifacts, must not be {@code null}.
* @return The dependency resolution result having the resolved extension class path but also the tree, never {@code null}.
* @throws PluginResolutionException If any dependency could not be resolved.
* @since 3.10.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

maybe we can also add a 4.x version here, or use only 4.x as @gnodet mention

@cstamas
cstamas merged commit c1de267 into apache:master Jun 22, 2026
22 checks passed
@cstamas
cstamas deleted the forward-port-plugin-dep-resolver branch June 22, 2026 07:43
ascheman added a commit that referenced this pull request Sep 8, 2026
resolveCoreExtensionAndFlatten and resolvePluginAndFlatten were added as
abstract methods in 4.0.0-rc-6, forward-porting the Maven 3.10.0 changes
(#12335). The interface is documented as internal, but it is the only
hook Maven offers for influencing plugin resolution, and every major
Java IDE overrides it: IntelliJ IDEA, Eclipse m2e and NetBeans. Those
implementations live out of tree and are compiled against one Maven
while running on another, so adding abstract methods turns plugin
resolution into an AbstractMethodError.

Both methods now default to the pre-existing resolvePlugin, which
DefaultPluginDependenciesResolver already treats as an alias -- there,
resolvePlugin delegates to resolvePluginAndFlatten. resolvePlugin itself
deliberately stays abstract: a default there would let an implementation
overriding neither method recurse infinitely.

The default for resolveCoreExtensionAndFlatten is best effort. A
dedicated implementation additionally reads the extension's artifact
descriptor to apply relocations and run MavenPluginDependenciesValidator.

Verified against the class shipped in IntelliJ IDEA 2026.2.2, which
implements resolvePluginAndFlatten but not resolveCoreExtensionAndFlatten
and therefore still fails on stock rc-6.

Adds a unit test pinning the compatibility contract and a core IT that
builds an extension against maven-core 4.0.0-rc-5 -- the last release
before the methods existed -- and runs a build through it.

Verified by Christofer Dutz (@chrisdutz) on Apache PLC4X: a build
carrying this change imports cleanly in IntelliJ IDEA, where stock rc-6
fails.

Forward port of 349395c from maven-4.0.x. The breaking change was
ported to both lines (#12329 master, #12335 maven-4.0.x); the fix so far
only to maven-4.0.x, so 4.1.0 would reintroduce the regression.

Two adjustments were needed for master, both in the IT only:

- no TestSuiteOrdering entry: that class now orders by name pattern
  (MavenITgh<number>) instead of keeping an explicit list
- the IT harness moved on: AbstractMavenIntegrationTestCase no longer
  takes a version range, extractResources returns Path, and
  newVerifier(String) is deprecated in favour of newVerifier(Path)

The production change and the unit test are byte-identical to
maven-4.0.x.

Closes #13068

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01W2HnhKt7MJWYsSSVUmPrvU
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants