Skip to content
Latchkey

Maven "Source option 8 is no longer supported" in CI

javac on a newer JDK refuses an obsolete -source/-target value. JDK 20 and later reject release 8, so a project still pinned to source 8 fails the moment the runner upgrades its JDK.

What this error means

maven-compiler-plugin fails with "Source option 8 is no longer supported. Use 9 or later." (or the matching "Target option" message) after a runner JDK bump.

mvn output
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project app:
Fatal error compiling: error: Source option 8 is no longer supported. Use 9 or later. -> [Help 1]

Common causes

A modern JDK dropped support for the old release

Each JDK removes the oldest few -source/-target values. JDK 20+ no longer accepts 8, so the old setting is invalid.

CI upgraded the JDK without updating the POM

The runner now provides a newer JDK than the source level the project still declares, so compilation fails.

How to fix it

Raise the release level the project targets

Use <release> (single source of truth) at a value the runner JDK still supports.

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

Or pin the runner to a JDK that still supports it

If you must keep source 8, run on a JDK that still accepts it (for example JDK 17).

.github/workflows/ci.yml
- uses: actions/setup-java@v4
  with:
    distribution: temurin
    java-version: '17'

How to prevent it

  • Track the minimum JDK each -source level still supports.
  • Prefer <release> over separate source/target.
  • Bump source levels when you bump the runner JDK.

Related guides

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