[backport 4.0.x] [MNG-8693] Avoid resolving unused plugins for direct goals - #12920
Merged
Conversation
* [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
commented
Aug 29, 2026
gnodet
left a comment
Contributor
Author
There was a problem hiding this comment.
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
doResolveFromProjectfollows the samePlugin.setVersion()mutation pattern already used byLifecyclePluginResolver.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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backport of #12721 to
maven-4.0.xfor 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 inpluginManagementor inactive profiles even when the goal does not use them.This change:
Cherry-picked from 1b0a19e (master).
🤖 Generated with Claude Code