sbt "Unsupported class file major version" in CI
A bytecode-processing tool (ASM inside a plugin, a coverage or shading step) encountered class files from a JDK newer than it understands and threw "Unsupported class file major version N". The tool or the JDK must be aligned.
What this error means
sbt fails with "IllegalArgumentException: Unsupported class file major version 65" (or 64/63) from an assembly, coverage, or bytecode-manipulating plugin.
[error] java.lang.IllegalArgumentException: Unsupported class file major version 65
[error] at org.objectweb.asm.ClassReader.<init>(ClassReader.java:...)Common causes
A plugin bundles an old ASM version
The bytecode library inside a plugin predates the JDK running the build (major 65 is Java 21), so it cannot parse the newer class files.
The CI JDK is newer than the tooling supports
setup-java installed a JDK ahead of what the plugin ecosystem handles, so a build step that reads bytecode fails.
How to fix it
Upgrade the plugin that bundles ASM
- Identify the plugin doing bytecode work (assembly, coverage, shading).
- Upgrade it to a version that supports the JDK in use.
- Re-run the step.
// project/plugins.sbt
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.2.0")Pin the CI JDK to a supported version
If a plugin cannot yet handle the newest JDK, set setup-java to a version it supports.
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'How to prevent it
- Keep bytecode-manipulating plugins current with your JDK.
- Pin the CI JDK to a version your plugin set supports.
- Test a JDK bump against the full plugin toolchain before adopting it.