Sonarqube 9.9.1 compatibility issue - how to resolve

Versions I’m using: sonarqube-9.9.1.69595, sonar-scanner-4.8.0.2856
how is SonarQube deployed: zip

Hello, I’ve been trying to set up Sonarqube with Gitlab runner (using Docker executor) to perform code analysis for Java projects (built with Java 8), so that each time when I commit new code to the main branch of my Gitlab repo, a Sonarqube job is triggered. I’m using Sonarqube version 9.9.1, and Scanner 4.8.0. The Docker container where the job runs currently uses JDK 8.

I’m getting the following error during the autobuild:
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

I wonder how to fix this problem. I’d like to keep using Sonarqube 9.9 LTS version, and the Java projects need to use Java 8.

I have tried to run in two steps, like first run “mvn clean install” on my Java project using Java 8, and then update JAVA_HOME to use Java 11 and run the sonar task excluding the previous build tasks (compile, test etc.), but so far it’s not working yet (given I’m not a Maven expert). Any suggestion? Thanks in advance

Nevermind, I have fixed the issue with the help of this post

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