An API incompatibility was encountered

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube Server / Community Build, Scanner, Plugin, and any relevant extension)
  • how is SonarQube deployed: zip, Docker, Helm - Zip
  • what are you trying to achieve - Sonar Analysis
  • what have you tried so far to achieve this - Passed project specific JDK version

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Hello Sonar Community,

We have recently upgraded our SonarQube application to 2025.1 from 9.9 Developer Edition.
SonarQube application runs on JDK17 and we have multiple Maven jobs that runs on JDK11.
I tried to use the suggested workaround Java | SonarQube Server Documentation but my builds are still failing.

Jenkins Configuration:

It has the option of "Prepare SonarQube Environment" checked and we are currently using 3.9.0 sonar-maven plugin.

On the post build section of Jenkins it used Goals as $SONAR_MAVEN_GOAL.

Even after changing the parameters on GOALS it is still failing with Java incompatibility issue.

Error Message:

Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar (default-cli) on project : 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 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

Please let me know if someone has the solution.

Thanks,
Bipin G.

Hey there.

I think you’re looking for these docs.

Thanks for pointing to that documentation. I have tried running with sonar-maven-plugin version 5.0 and we no longer see the api incompatibility issue any more.

Now we ran into something else “Error during SonarScanner Engine execution org.sonar.java.AnalysisException: Your project contains .java files, please provide compiled classes with sonar.java.binaries property, or exclude them from the analysis with sonar.exclusions property.”

Can someone help into this ?

You’ll have to provide more details about your build. Typically this would indicate that mvn sonar:sonar is being run without build steps before it (like mvn clean verify)