Error:
build 19-Feb-2025 09:03:26 [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:4.0.0.4121:sonar (default-cli) on project X: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:4.0.0.4121:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:4.0.0.4121:sonar: java.lang.UnsupportedClassVersionError: org/sonar/batch/bootstrapper/EnvironmentInformation has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
Thanks. What I think you want to do is make sure that JAVA_HOME is pointing to a Java 17 installation or higher. See the docs here.
Adjusting sonar.java.source is having no affect on this error message.
With all that said, this version of the SonarScanner for Maven should support JRE Auto-provisioning as long as you’re connecting to a version of SonarQube v10.6 or higher. In this case you shouldn’t have to do anything to have a successful scan.
What version of SonarQube are you using? This information is available in the footer of your SonarQube instance.
Then I suggest you bump up your version of the Scanner for Maven.
And,v10.6 is no longer a supported version of SonarQube. I suggest you upgrade to the latest version. However, your existing setup should support JRE auto-provisioning like I mentioned.