[Backport 4.0.x] Fix #12985: Upgrade toolchains-plugin when adding select-jdk-toolchain execution - #13026
Merged
Conversation
…n execution (#12999) * Fix #12985: Upgrade toolchains-plugin when adding select-jdk-toolchain execution When ToolchainPluginStrategy adds a select-jdk-toolchain execution, it now ensures the maven-toolchains-plugin version is >= 3.2.0 (the first version containing that goal). Previously, the plugin was added without a version, causing builds to fail when the project inherited an older version like 1.1 which only has 'help' and 'toolchain' goals. Changes: - Set plugin version to 3.2.0 when creating a new toolchains-plugin entry - Reuse existing toolchains-plugin entry instead of creating duplicates - Upgrade version of existing entries below 3.2.0 (in both build/plugins and build/pluginManagement/plugins) - Skip property-referenced versions to avoid unintended side effects Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Address review feedback: warn on property versions, extract shared matching - Log a warning when skipping property-referenced versions (e.g. ${toolchains.version}) so users know to verify the resolved version is >= 3.2.0 manually - Extract isToolchainsPlugin() helper to deduplicate groupId/artifactId matching between findToolchainsPlugin() and hasSelectGoalInPluginSection() Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Share plugin version upgrade via PluginUpgradeStrategy Add maven-toolchains-plugin to the PLUGIN_UPGRADES list in PluginUpgradeStrategy (min version 3.2.0) so existing toolchains-plugin entries are upgraded through the same mechanism as all other plugins. ToolchainPluginStrategy no longer duplicates version comparison and upgrade logic — it only creates new plugin entries (with version 3.2.0) and adds select-jdk-toolchain executions. Version upgrades of existing entries are handled by PluginUpgradeStrategy, which runs first (priority 10 vs 15). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.
Backport of #12999 to
maven-4.0.x.Summary
ToolchainPluginStrategyadds aselect-jdk-toolchainexecution, it now ensures themaven-toolchains-pluginversion is >= 3.2.0 (the first version containing that goal)helpandtoolchaingoals)build/pluginsandbuild/pluginManagement/plugins