gnodet opened a new issue, #14163:
URL: https://github.com/apache/maven/issues/14163
## Problem
`mvnup`'s `ToolchainPluginStrategy` only injects `select-jdk-toolchain` when
the project's `--source` level is deprecated by JEP 182 (source <=5 requires
JDK 8, source 6 requires JDK 11, etc.). It does not detect usage of Java EE
APIs that were physically removed from the JDK in Java 11 (JEP 320):
- `javax.xml.bind.*` (JAXB)
- `javax.annotation.*` (JSR-305/JSR-250 package)
- `javax.xml.ws.*` (JAX-WS)
- `javax.activation.*` (JavaBeans Activation Framework)
These projects declare `--source 8` (which mvnup considers "supported by all
current JDKs") but their code imports from packages that are only present in
JDK 8's `rt.jar`. Without toolchain injection, Maven 4 compiles with JDK 17 and
the compilation fails.
## Affected projects (from maven4-testing 2026-11-28 run)
All have `jdk-overrides.json = 8` (telling the test harness to use JDK 8 for
Maven 3) but Maven 4 runs on JDK 17 and mvnup fails to inject toolchain:
- `apache/incubator-batchee` (#41712) — `javax.xml.bind.annotation does not
exist`
- `apache/ambari-metrics` (#41601) — `cannot find symbol: class XmlElement`
(javax.xml.bind)
- `apache/sirona` (#42118) — `package javax.annotation does not exist`
- `apache/rocketmq-remoting` (#41903) — `package javax.annotation does not
exist`
- `apache/phoenix-omid` (#41751) — `package javax.annotation does not exist`
(protobuf generated)
## Root cause
`ToolchainPluginStrategy.getLatestJdkVersionForSourceLevel()` maps source
levels to retirement data from JEP 182, but doesn't consult JEP 320 (Removal of
the Java EE and CORBA Modules). A project with `source=8` that uses
`javax.xml.bind` returns `latestJdkForSourceLevel(8) = -1` ("supported by all")
=> no toolchain injected.
mvnup has no analysis of import statements or classpath dependencies, so it
cannot detect which APIs the project actually uses.
## Expected behavior
When mvnup encounters a project that uses removed Java EE APIs, it should
either:
1. Inject `select-jdk-toolchain` with `<version>(,8]</version>`
(conservative approach), OR
2. Add explicit Jakarta EE API dependencies (e.g.
`javax.xml.bind:jaxb-api:2.3.1`) to replace the removed JDK packages.
Option 2 is preferred as it makes the project portable across JDK versions
without requiring a JDK 8 toolchain.
## Workaround
Manually add the project to `jdk-overrides.json` in `gnodet/maven4-testing`.
mvnup cannot fix this automatically without the enhancement described above.
--
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]