Failed to execute goal Java 8

Failed to execute goal e[32morg.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonare[m e[1m(default-cli)e[m on project e[36e[m: e[1;31mExecution 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.0e[m

Hi @Sana_Rannen,

Welcome to the community!

From the logs you attached,

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.0e

the issue may be caused from the fact that the Java version that you used for the scanner and the Java version that you used to compile the project are inconsistent. So please try to use the same java version and run the analysis again.

If the issue persists, please share the full logs for this project for the further investigation.
Best regards,
Fan

2 Likes

Hello, @Fan_Yang thanks for your response.
How can I modify the java version used for the scanner ?
Kind regards,
Sana

Hi,

In order to modify the java version for the scanner, you need to update $JAVA_HOME before running the analysis. Please try with this and provide the full logs if the issue persists.

Best regards,
Fan

Hi @Fan_Yang , The issuse persists.

[Pipeline] } [Pipeline] // stage [Pipeline] stage [Pipeline] { (Sonar scan execution) [Pipeline] withCredentials Masking supported pattern matches of $sonar [Pipeline] { [Pipeline] sh + mvn sonar:sonar -Dsonar.host.url=http://51.255.75.77:9000 -Dsonar.login=****

[e[1;34mINFOe[m] Scanning for projects…

[e[1;33mWARNINGe[m] [e[1;33mWARNINGe[m] Some problems were encountered while building the effective model for easy_flow_backend.example:easy_flow_backend:jar:0.0.1-SNAPSHOT [e[1;33mWARNINGe[m] ‘dependencies.dependency.(groupId:artifactId:type:classifier)’ must be unique: org.springframework.boot:spring-boot-starter-data-jpa:jar → duplicate declaration of version (?) @ line 60, column 15 [e[1;33mWARNINGe[m] ‘dependencies.dependency.(groupId:artifactId:type:classifier)’ must be unique: org.springframework.boot:spring-boot-starter-test:jar → duplicate declaration of version (?) @ line 65, column 13 [e[1;33mWARNINGe[m] ‘build.plugins.plugin.(groupId:artifactId)’ must be unique but found duplicate declaration of plugin org.apache.maven.plugins:maven-checkstyle-plugin @ line 124, column 18 [e[1;33mWARNINGe[m] [e[1;33mWARNINGe[m] It is highly recommended to fix these problems because they threaten the stability of your build. [e[1;33mWARNINGe[m] [e[1;33mWARNINGe[m] For this reason, future Maven versions might no longer support building such malformed projects. [e[1;33mWARNINGe[m] [e[1;34mINFOe[m] [e[1;34mINFOe[m] e[1m------------< e[0;36measy_flow_backend.example:easy_flow_backende[0;1m >-------------e[m [e[1;34mINFOe[m] e[1mBuilding easy_flow_backend 0.0.1-SNAPSHOTe[m [e[1;34mINFOe[m] e[1m--------------------------------[ jar ]---------------------------------e[m [e[1;34mINFOe[m] [e[1;34mINFOe[m] e[1m— e[0;32msonar-maven-plugin:3.4.0.905:sonare[m e[1m(default-cli)e[m @ e[36measy_flow_backende[0;1m —e[m [e[1;34mINFOe[m] User cache: /var/lib/jenkins/.sonar/cache [e[1;34mINFOe[m] SonarQube version: 9.0.1 [e[1;34mINFOe[m] Default locale: “en_US”, source code encoding: “UTF-8” [e[1;34mINFOe[m] e[1m------------------------------------------------------------------------e[m [e[1;34mINFOe[m] e[1;31mBUILD FAILUREe[m [e[1;34mINFOe[m] e[1m------------------------------------------------------------------------e[m [e[1;34mINFOe[m] Total time: 1.437 s [e[1;34mINFOe[m] Finished at: 2021-08-18T12:00:25Z [e[1;34mINFOe[m] e[1m------------------------------------------------------------------------e[m [e[1;31mERRORe[m] Failed to execute goal e[32morg.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonare[m e[1m(default-cli)e[m on project e[36measy_flow_backende[m: e[1;31mExecution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905: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.0e[m [e[1;31mERRORe[m] e[1;31m-----------------------------------------------------e[m [e[1;31mERRORe[m] e[1;31mrealm = plugin>org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905e[m [e[1;31mERRORe[m] e[1;31mstrategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategye[m [e[1;31mERRORe[m] e[1;31murls[0] = file:/var/lib/jenkins/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/3.4.0.905/sonar-maven-plugin-3.4.0.905.jare[m [e[1;31mERRORe[m] e[1;31murls[1] = file:/var/lib/jenkins/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jare[m [e[1;31mERRORe[m] e[1;31murls[2] = file:/var/lib/jenkins/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jare[m [e[1;31mERRORe[m] e[1;31murls[3] = file:/var/lib/jenkins/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jare[m [e[1;31mERRORe[m] e[1;31murls[4] = file:/var/lib/jenkins/.m2/repository/org/sonarsource/scanner/api/sonar-scanner-api/2.10.0.1189/sonar-scanner-api-2.10.0.1189.jare[m [e[1;31mERRORe[m] e[1;31murls[5] = file:/var/lib/jenkins/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jare[m [e[1;31mERRORe[m] e[1;31mNumber of foreign imports: 1e[m [e[1;31mERRORe[m] e[1;31mimport: Entry[import from realm ClassRealm[maven.api, parent: null]]e[m [e[1;31mERRORe[m] e[1;31me[m [e[1;31mERRORe[m] e[1;31m-----------------------------------------------------e[m [e[1;31mERRORe[m] e[1;31me[m [e[1;31mERRORe[m] → e[1m[Help 1]e[m [e[1;31mERRORe[m] [e[1;31mERRORe[m] To see the full stack trace of the errors, re-run Maven with the e[1m-ee[m switch. [e[1;31mERRORe[m] Re-run Maven using the e[1m-Xe[m switch to enable full debug logging. [e[1;31mERRORe[m] [e[1;31mERRORe[m] For more information about the errors and possible solutions, please read the following articles: [e[1;31mERRORe[m] e[1m[Help 1]e[m PluginContainerException - Apache Maven - Apache Software Foundation

[Pipeline] } [Pipeline] // withCredentials [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline ERROR: script returned exit code 1

Finished: FAILURE

Hi @Sana_Rannen,

Could you kindly help to clarify which Java version you are using to execute the analysis, please?

We assume that you are trying to execute the analysis with Java 8(class file version 52), but we require Java 11(class file version 55) to run as stated in our documentation .

Please try to run it with Java 11.
Best regards,
Fan

Thanks @Fan_Yang

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