You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mvnup: missing toolchain injection for projects using JDK EE APIs removed in Java 11 (javax.xml.bind, javax.annotation) #14163
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):
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.
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:
Inject select-jdk-toolchain with <version>(,8]</version> (conservative approach), OR
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.
Activity