Skip to content

Forward port Maven 3.10.0 PluginDependenciesResolver changes - #12335

Merged
cstamas merged 1 commit into
apache:maven-4.0.xfrom
cstamas:maven-4.0.x-forward-port-plugin-dep-resolver
Jun 22, 2026
Merged

cstamas merged 1 commit into
apache:maven-4.0.xfrom
cstamas:maven-4.0.x-forward-port-plugin-dep-resolver

Conversation

@cstamas

@cstamas cstamas commented Jun 22, 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.

Backport from master c1de267

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.

Backport from master c1de267
@cstamas
cstamas requested a review from gnodet June 22, 2026 07:45
@cstamas cstamas self-assigned this Jun 22, 2026
@cstamas
cstamas requested a review from slawekjaranowski June 22, 2026 07:45
@cstamas cstamas added this to the 4.0.0-rc-6 milestone Jun 22, 2026
@cstamas

cstamas commented Jun 22, 2026

Copy link
Copy Markdown
Member Author

This is a backport to 4.0.x of forward port to master from 3.10.x 😄
Will merge once green.

@cstamas
cstamas marked this pull request as ready for review June 22, 2026 09:02
@cstamas
cstamas merged commit eaa575e into apache:maven-4.0.x Jun 22, 2026
22 checks passed
@cstamas
cstamas deleted the maven-4.0.x-forward-port-plugin-dep-resolver branch June 22, 2026 09:13
ascheman added a commit to aschemaven/maven that referenced this pull request Sep 7, 2026
resolveCoreExtensionAndFlatten and resolvePluginAndFlatten were added as
abstract methods in 4.0.0-rc-6, forward-porting the Maven 3.10.0 changes
(apache#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.

Closes apache#13068

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01W2HnhKt7MJWYsSSVUmPrvU
ascheman added a commit to aschemaven/maven that referenced this pull request Sep 7, 2026
resolveCoreExtensionAndFlatten and resolvePluginAndFlatten were added as
abstract methods in 4.0.0-rc-6, forward-porting the Maven 3.10.0 changes
(apache#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.

Closes apache#13068

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01W2HnhKt7MJWYsSSVUmPrvU
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.

Closes #13068

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01W2HnhKt7MJWYsSSVUmPrvU
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.

1 participant