I am trying to compile a basic Java spring boot project with maven (running mvn clean install). I am getting this error.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project my-api: Fatal error compiling: error: release version 21 not supported
when I run mvn -version I get the following
Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 21.0.2, vendor: Private Build, runtime: /usr/lib/jvm/java-21-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: “linux”, version: “6.5.0-25-generic”, arch: “amd64”, family: “unix”
I’ve tried using update-alternatives to switch my Java version to 17, then 11, then 8 and changing my pom.xml file to point to those versions but I get the same error albeit with that version.
ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project jeff-website-api: Fatal error compiling: error: release version 8 not supported
What am I missing?