Repository navigation
[Backport maven-4.0.x] Fix #12989: mvnup plugin upgrades should respect project JDK version - #13024
Merged
Merged
Conversation
* Fix #12989: mvnup plugin upgrades should respect project JDK version Add JDK compatibility checking to PluginUpgradeStrategy so that plugins requiring a higher JDK than the project targets are skipped rather than blindly upgraded. This prevents UnsupportedClassVersionError at build time (e.g., checkstyle-plugin 3.6.0 pulls Checkstyle 10.x which requires JDK 21, breaking projects that target JDK 17). Changes: - Add minJdk field to PluginUpgrade record and PluginUpgradeInfo class - Add detectProjectJdkVersion() method that reads maven.compiler.release, maven.compiler.source, maven.compiler.target, and compiler plugin config - Add JDK compatibility guard in upgradePluginVersion() (similar to the existing Quarkus 2.x skip pattern) - Add JDK compatibility guard in effective model analysis path - Register maven-checkstyle-plugin 3.6.0 with minJdk=21 - Add comprehensive tests in PluginUpgradeJdkCompatibilityTest Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Address review feedback: extract JDK skip helper, sort POMs by path depth - Extract duplicated JDK compatibility check into shouldSkipForJdkIncompatibility() helper method, eliminating the inline logic in both build/plugins and pluginManagement/plugins analysis paths - Sort pomMap entries by path depth (shortest first) when detecting the project JDK version, so the root POM is checked before child modules in multi-module projects 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 #12994 to
maven-4.0.x.Cherry-pick of 5caa2a0 from master.
Summary
Adds JDK compatibility checking to
PluginUpgradeStrategyso that plugin upgrades requiring a higher JDK than the project targets are skipped rather than blindly applied. PreventsUnsupportedClassVersionError(e.g., checkstyle-plugin 3.6.0 → Checkstyle 10.x requires JDK 21).Changes
minJdkfield toPluginUpgraderecord (defaults to 0 = no restriction)maven.compiler.release,.source,.target, and compiler plugin configmaven-checkstyle-plugin3.6.0 withminJdk=21