gnodet opened a new pull request, #12994:
URL: https://github.com/apache/maven/pull/12994
## Summary
- Adds JDK compatibility checking to `PluginUpgradeStrategy` so that plugin
upgrades requiring a higher JDK than the project targets are **skipped** rather
than blindly applied
- Extends the `PluginUpgrade` record with a `minJdk` field (defaults to `0`
= no restriction)
- Detects the project's JDK version from `maven.compiler.release`,
`maven.compiler.source`, `maven.compiler.target`, and compiler plugin
`<configuration>`
- Registers `maven-checkstyle-plugin` 3.6.0 with `minJdk=21` (Checkstyle
10.x requires JDK 21)
- Guards both the direct upgrade path and the effective-model analysis path
## Problem
`mvnup` upgrades `maven-checkstyle-plugin` to 3.6.0, which transitively
pulls Checkstyle 10.x. Checkstyle 10.x requires JDK 21 (class file version
65.0), but projects like `directory-ldap-api` and `directory-server` build with
JDK 17, causing:
```
UnsupportedClassVersionError:
com/puppycrawl/tools/checkstyle/api/CheckstyleException
has been compiled by a more recent version of the Java Runtime (class file
version 65.0),
this version of the Java Runtime only recognizes class file versions up to
61.0
```
## Design
The JDK compatibility check follows the same pattern as the existing Quarkus
2.x skip logic:
1. Before upgrading a plugin, check if `minJdk > 0`
2. If so, detect the project's JDK version from POM properties/compiler
config
3. If the project's JDK is below the plugin's `minJdk`, skip the upgrade
with a warning
The `minJdk` field on `PluginUpgrade` is opt-in (defaults to `0` = no JDK
check), so existing plugin upgrades are unaffected.
## Test plan
- [x] 8 tests for project JDK detection (release, source, target,
precedence, old-style `1.8`, compiler plugin config, no-config, property-ref)
- [x] 8 tests for JDK compatibility skip (JDK 17 skip, JDK 11 skip, JDK 21
upgrade, JDK 23 upgrade, no-JDK upgrade, property version skip, no-minJdk
passthrough, pluginManagement skip)
- [x] 4 tests for `PluginUpgrade` record constructors and checkstyle-plugin
configuration
- [x] All 83 existing plugin upgrade tests still pass
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]