How to analysis java 8 application(maven 3.6.3) with sonarqube 9.5

Must-share information (formatted with [Markdown](https://commonmark.org/help/)):
* which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
SonarQube 9.5 community

* what are you trying to achieve
the application environment is Java 8 and Maven 3.6.3, I try to analysis application with this script
mvn clean verify sonar:sonar -Dsonar.projectKey=my-webapp -Dsonar.host.url=https://sonar.local.com -Dsonar.login=*****************


* what have you tried so far to achieve this
I read this https://docs.sonarqube.org/latest/analysis/languages/java/#header-3 but I don`t know how to set **sonar.java.jdkHome=/usr/lib/jvm/jdk1.8.0_211** previous script.

I try to execute the script like this

mvn clean verify sonar:sonar -Dsonar.projectKey=my-webapp -Dsonar.host.url=https://sonar.local.com -Dsonar.login=***************** -Dsonar.java.jdkHome=/usr/lib/jvm/jdk1.8.0_211

log shows java is not compatible
|24-Jul-2022 22:56:30|[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project ssg-mdpo-webapp: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184: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|
|---|---|
|24-Jul-2022 22:56:30|[ERROR] -----------------------------------------------------|
|24-Jul-2022 22:56:30|[ERROR] realm =    plugin>org.codehaus.mojo:sonar-maven-plugin:3.9.1.2184|
|24-Jul-2022 22:56:30|[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy|
|24-Jul-2022 22:56:30|[ERROR] urls[0] = file:/root/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/3.9.1.2184/sonar-maven-plugin-3.9.1.2184.jar|
|24-Jul-2022 22:56:30|[ERROR] urls[1] = file:/root/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar|
|24-Jul-2022 22:56:30|[ERROR] urls[2] = file:/root/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar|
|24-Jul-2022 22:56:30|[ERROR] urls[3] = file:/root/.m2/repository/org/codehaus/plexus/plexus-utils/3.2.1/plexus-utils-3.2.1.jar|
|24-Jul-2022 22:56:30|[ERROR] urls[4] = file:/root/.m2/repository/org/sonarsource/scanner/api/sonar-scanner-api/2.16.2.588/sonar-scanner-api-2.16.2.588.jar|
|24-Jul-2022 22:56:30|[ERROR] urls[5] = file:/root/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar|
|24-Jul-2022 22:56:30|[ERROR] Number of foreign imports: 1|
|24-Jul-2022 22:56:30|[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]|

How do i fix it?

Hey there.

Check the documentation on Scanner Environment

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