Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746

Currently java version is java 11, SonarQube is integrated with Jenkins, need help on issue:

Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (sonarqube) on project amp.wcp.build: Execution sonarqube of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746: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

Hi,

Welcome to the community!

Your error message indicates that Java 8 is being invoked for analysis (ref):

It’s likely that you have Maven directly pointed to Java 8 or that there’s a $JAVA_HOME variable in your environment pointing to Java 8.

 
HTH,
Ann

Thank you for your reply.
What’s the proper way to have Maven point to right location? we had a java 11 installed on build server, set
<sonar.java.jdkHome> ${SONARQUBE_JAVA_HOME} </sonar.java.jdkHome> in pom.xml Maven, and configurated to that location in Maven, but it seems it didn’t work.

Thank you

Holly

Hi Holly,

By the time that value is read in your POM, Java has already been invoked and is already running. :slightly_smiling_face: Try setting a $JAVA_HOME environment variable.

 
Ann