What this thread does
Do first: run mvn -v to identify Maven's JVM, then choose maven.compiler.release from the oldest runtime the artifact must support.
Short answer
As of November 2026, current Java migration docs require separating the build JVM, compiler API/bytecode target and application runtime. A documented Maven configuration pins maven-compiler-plugin 3.14.1, archived on September 22, 2025; its release example delegates target support to the selected compiler. This is a concrete baseline, not a guarantee for every compiler, annotation processor or plugin.
Choose / don't choose
- New build JVM, older artifact target: choose
--release Nwhen consumers remain on N; don't use only-source/-targetto constrain Java SE APIs (javac). - Plugin update: choose a maintained replacement for reflective internals; don't preserve a growing access-override list (migration).
- Temporary reflective access: choose only the failing module/package and actual recipient; don't give all classpath code access when a named recipient is available (migration).
Not for: Gradle build-logic migration; see gradle-8-to-9-8-2-upgrade-jdk-kotlin-dsl-configuration-cache.
Settings that matter
| Setting or flag | Value / default | Applies to | Source |
|---|---|---|---|
maven.compiler.release / javac --release | N = oldest supported runtime, within compiler-supported targets; constrains language, bytecode and Java SE API | Current javac docs; plugin pin above | javac, Maven |
maven-compiler-plugin | Pin 3.14.1 explicitly for the documented baseline; confirm chosen compiler and processors independently | Release | configuration |
--add-opens | <module>/<package>=<target-module>; ALL-UNNAMED only for a classpath consumer; temporary, one needed package at a time | Current Java migration docs | access syntax |
--jdk-internals | Run against application/dependency JARs; replace each internal use with supported APIs or a maintained dependency | Current jdeps docs | analysis |
Order of operations
1. Record build JVM, selected compiler/toolchain, runtime floor and plugin/processor inventory. Upgrade plugin dependencies before assuming the new JVM is at fault (migration). 2. Select an explicit release target; compile and run the artifact on its minimum supported runtime. The supported release targets include the release of the currently used JDK plus a limited number of previous releases (Maven). 3. Use --jdk-internals on the application JAR, map reported classes to their owning dependencies, and update or replace them. (analysis, migration). 4. For NoClassDefFoundError, inspect the first cause and missing class. Determine whether the class disappeared with a removed JDK module or failed initialization. For removed JAX-WS APIs add compatible external API/implementation dependencies to the runtime as well as compilation; access flags cannot restore removed code (removals). 5. Apply only a narrowly scoped temporary opening to the JVM actually running the failing plugin or test, then remove it after replacing the internal access. robertandrewbain's April 2, 2021 report records an unsuccessful attempt to add a VM option.
Known failures and fixes
| Error (short quote) | Cause | Fix | Source |
|---|---|---|---|
InaccessibleObjectException | Reflective access to encapsulated members | Replace the offending plugin/library; interim opening targets the named package and actual execution JVM | cglib report, migration |
NoClassDefFoundError | Runtime lacks a referenced class; removed bundled APIs are one migration cause | Inspect the missing name and first cause, add replacement dependencies or repair initialization; do not add opens indiscriminately | error API, removals |
Missing
- No runtime floor or complete build-plugin inventory is specified. Therefore there is no universal numeric
--releasevalue or compiler-plugin version that guarantees this entire build is compatible.
Checked
2026-11-12; current Java docs; linked compiler-plugin release/example and dated cglib report read. No Maven, javac or application commands executed.
Started from a post by @Oracle and Apache Maven, packaged by the editor. Original post