Skip to content

[backport 4.0.x] [MNG-8693] Avoid resolving unused plugins for direct goals - #12920

Merged
gnodet merged 1 commit into
maven-4.0.xfrom
backport/12721-to-maven-4.0.x
Aug 29, 2026
Merged

[backport 4.0.x] [MNG-8693] Avoid resolving unused plugins for direct goals#12920
gnodet merged 1 commit into
maven-4.0.xfrom
backport/12721-to-maven-4.0.x

Conversation

@gnodet

@gnodet gnodet commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Backport of #12721 to maven-4.0.x for the rc-7 release.

Fixes #10128.

Direct CLI goals (prefix:goal) currently trigger missing-version resolution for every plugin in the project before Maven resolves the requested goal. This causes unnecessary downloads of plugins declared in pluginManagement or inactive profiles even when the goal does not use them.

This change:

  • Skips project-wide plugin version resolution while calculating direct goal task segments
  • Limits project-wide resolution during execution planning to plans that contain lifecycle phases
  • Resolves a missing version lazily when a project-declared plugin is actually considered during prefix resolution

Cherry-picked from 1b0a19e (master).

🤖 Generated with Claude Code

* [MNG-8693] Avoid resolving unused plugins for direct goals

Skip project-wide plugin version resolution for direct-goal-only plans while preserving it for lifecycle phases. Resolve versionless project prefix candidates lazily and add regression coverage for both paths.

* [MNG-8693] Verify lifecycle plugin resolution

Add the complementary positive regression that lifecycle tasks continue to resolve missing project plugin versions before lifecycle mapping.
@gnodet gnodet added this to the 4.0.0-rc-7 milestone Aug 29, 2026
@gnodet gnodet added the bug Something isn't working label Aug 29, 2026

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Clean cherry-pick backport of #12721 from master to maven-4.0.x. No issues found.

Backport observations:

  • Diffs are identical to the original (only cosmetic git index hashes and a trivial 1-line offset difference).
  • The change correctly avoids eager resolution of all project plugin versions when only direct goals are invoked, moving to lazy per-plugin resolution in DefaultPluginPrefixResolver.
  • The lazy version resolution in doResolveFromProject follows the same Plugin.setVersion() mutation pattern already used by LifecyclePluginResolver.resolveMissingPluginVersions, consistent with existing conventions.
  • Error handling is correct: the new pluginVersionResolver.resolve() call sits inside the existing try-catch block.
  • Both new test classes match the maven-4.0.x API.

🔀 Backport Status

Backport to maven-3.9.x / maven-3.10.x likely not applicable — the fix involves ConcurrentLifecycleStarter (Maven 4.x only) and the impl/maven-core path restructuring.

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of Guillaume Nodet

@gnodet
gnodet merged commit 3cf0f14 into maven-4.0.x Aug 29, 2026
24 checks passed
@gnodet
gnodet deleted the backport/12721-to-maven-4.0.x branch August 29, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants