An API incompatibility was encountered (Encountered error upon execute of mvn sonar:sonar on project )

Error encountered:
Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar: java.lang.UnsupportedClassVersionError: org/sonar/batch/bootstrapper/EnvironmentInformation has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

SonarQube

  • Community Edition
  • Version 9.0 (build 45539)

My java version is 1.8

Running it via docker.

Steps taken:

  1. Go to project folder (project is built in maven)
  2. Execute mvn sonar:sonar etc specified command followed on SonarQube

It seems like a java version mismatch. What SonarQube version is compatible with a Java 8?

Hi,

Welcome to the community!

Rather than downgrading your SonarQube version (baaaad idea. Think of all the features you’d loose. Think of all bug fixes and vulnerability patches.) you need to split the Java version you compile to from the version you analyze with. This is addressed by the docs.

 
HTH,
Ann