Reduce plugin downloads during prefix resolution via two-pass heuristic#11071
Reduce plugin downloads during prefix resolution via two-pass heuristic#11071gnodet wants to merge 1 commit intoapache:masterfrom
Conversation
…wo-pass heuristic on artifactId; add unit tests This change avoids loading plugin descriptors for non-candidate plugins by first filtering declared plugins using a conventional artifactId→prefix mapping (e.g., maven-compiler-plugin → compiler). If a match is not found, we fall back to the original full scan to preserve correctness for custom goalPrefix values. Adds DefaultPluginPrefixResolverTest to verify: - Only candidate plugin descriptor is loaded based on heuristic - Fallback full scan resolves custom goalPrefix correctly Fixes apache#11067
|
Ah, so prefix resolver was going over all defined plugins, getting descriptor just to select the right one? |
|
What if we change prefix resolver? Right now, this distinction makes not much sense: (resolve from project, or just resolve == the endgame is equal to this below) Proposed change:
This would be MUCH faster and intuitive, then iterating over all project plugins for nothing... also, there is no need for heuristic at all, as we talk about groupId -> prefix mapping, and not about plugin -> descriptor -> prefix mapping (that has much higher cardinality that groupIds involved). |
#11072 looks indeed much better. |
This PR introduces a conservative optimization in DefaultPluginPrefixResolver to avoid resolving/downloading all declared plugins when resolving a goal prefix.
Summary:
Motivation:
As reported in #11067, resolving plugin prefixes could trigger downloads of every declared plugin because the implementation loads each plugin descriptor to check goalPrefix. This change significantly reduces that cost in typical projects without changing resolution precedence.
Notes:
Pull Request opened by Augment Code with guidance from the PR author