Skip to content
Latchkey

Maven "Unsupported class file major version 65" - Fix in CI

A tool that parses bytecode (ASM, used by shade, jacoco, lombok-style plugins, or a scanner) hit a class compiled for Java 21 (class-file major version 65) and does not understand that version yet. The plugin or its bundled ASM predates the JDK you compiled with.

What this error means

A plugin goal throws IllegalArgumentException: Unsupported class file major version 65 (65 = Java 21; 64 = Java 20; 63 = Java 19) from deep inside an ASM ClassReader. The compile may succeed but a later analysis/packaging goal fails.

maven
[ERROR] Failed to execute goal org.jacoco:jacoco-maven-plugin:0.8.7:report
(report) on project app: An error has occurred in JaCoCo report generation:
java.lang.IllegalArgumentException: Unsupported class file major version 65

Common causes

A bytecode plugin is too old for the JDK

JaCoCo, Shade, or another ASM-based plugin bundles an ASM that does not yet support the major version your JDK emits.

Compiling with a newer JDK than the tools expect

The runner upgraded to JDK 21 but plugin versions were not bumped, so they read class files they cannot parse.

A transitive ASM pinned too low

Dependency management forces an older ASM onto a plugin that would otherwise support the version.

How to fix it

Upgrade the offending plugin

Bump the plugin to a version whose ASM supports your class-file version (e.g. JaCoCo 0.8.11+ for Java 21).

pom.xml
<plugin>
  <groupId>org.jacoco</groupId>
  <artifactId>jacoco-maven-plugin</artifactId>
  <version>0.8.12</version>
</plugin>

Align the compile target with tool support

If you cannot upgrade tooling, compile to a class-file version the plugins understand.

pom.xml
<properties>
  <maven.compiler.release>17</maven.compiler.release>
</properties>

Override a too-low transitive ASM

Force a modern ASM if dependency management pinned an old one onto the plugin.

pom.xml
<dependency>
  <groupId>org.ow2.asm</groupId>
  <artifactId>asm</artifactId>
  <version>9.7</version>
</dependency>

How to prevent it

  • Bump ASM-based plugins (JaCoCo, Shade) whenever you raise the JDK.
  • Keep the compile release and toolchain in sync with plugin support.
  • Pin plugin versions explicitly so JDK upgrades surface tool gaps in CI.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →