Skip to content

mvnup: missing toolchain injection for projects using JDK EE APIs removed in Java 11 (javax.xml.bind, javax.annotation) #14163

Backlog

Description

@gnodet

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions