Got UnsupportedClassVersionError with proper sonar.java.source settings

Hi Everyone,

Got this exception during the maven build:
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

Yes, the Sonar server is on Java11, and my source is in Java8.
However my pom.xml contains:

<sonar.java.source>1.8</sonar.java.source>
<sonar.java.target>1.8</sonar.java.target>

And I have even tried to add this from command line:
mvn clean install sonar:sonar -Dsonar.login=… -Dsonar.java.source=1.8

When I give -Dsonar.scanner.dumpToFile=file.txt to the build, the dump file contains sonar.java.source=1.8.

Don’t have any other ideas :slight_smile:
It could be important: sonar-maven-plugin:3.9.1.2184:sonar is the plugin I am fighting.

Hi,

The analysis step (sonar:sonar goal) must be executed on JDK 11. There’s some guidance here:
https://docs3.sonarqube.org/latest/analysis/analysis-with-java-11/

Thank you Felipe,

sonar:sonar with jdk11 is working fine. I am doing some tests how this and the maven-compiler-plugin java8 restriction can work together. But seems to be fine for now.

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