Problem with Jenkins + SonarQube

Hello, I’ve installed SonarQube on Linux VM with Java17 version using this tutorial:

The app works and I wanted to connect it with Jenkins - I’ve added SonarQube Scanner plugin etc.
My testing app seems to be in Java8

So I’ve added to VM Java8 and changed value as in this documentation Java


and still have error:

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin: (default-cli) on project demo: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin: failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin: 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 52.0

Can I ask for help?

Welcome :slight_smile:

the property is used to specify which JDK classes the analyzer must refer to during the analysis, ensuring consistent and accurate issue reporting, especially in relation to native JDK classes.

You didn’t mention your Sonarqube version, but i guess it’s latest as class file version 61.0 means you need to run the Sonarqube scan with Java 17.

You may compile with Java 8, but the maven sonar:sonar goal needs to run with Java 17.
In our Jenkins pipelines, we use one Maven CLI call for the build and another one for the Sonarqube analysis via sonar:sonar that runs always with Java 17.


Yea my sonarqube is the latest, so what do you suggest me to do?
I’ve changed to temurin-17-jdk-amd64 and still has the error about JavaRuntime.

The property is only some extra information for the analysis.
But the analysis itself has to run with Java 17, when in your case it runs with Java 8 (class version 52.0)

You may use 2 Maven CLI commands like that, i.e.

this may run with Java 8 for compilation

withMaven(jdk: ..., maven: ..., globalMavenSettingsConfig: ...) {
  sh 'mvn clean install'

but this has to run with Java 17 and nodejs 20 is recommended

nodejs(configId: ..., nodeJSInstallationName: 'nodejs-20') {
  withSonarQubeEnv(...) {
    withMaven(jdk: 'java-17-openjdk', maven: ..., globalMavenSettingsConfig: ...) {
      sh 'mvn sonar:sonar'

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.