-
which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
sonarqube-10.5, plugin version id(“org.sonarqube”) version “5.0.0.4638” -
how is SonarQube deployed: zip, Docker, Helm
SonarQube deployed by zip -
what are you trying to achieve
We have to analyze java 11 based gradle projects in SonarQube enterprise version 10.5.1. But we getting error(pls refer below)
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 -
what have you tried so far to achieve this
we have set the JAVA_HOME to java11.
But it is not referring java11
Hi @Ajaykumar ,
My understanding is that you try to scan a class compiled with JDK 17 with a scanner running on JRE 11.
Hi @Bachri_Abdel ,
We have some projects based on Java 11 & Java 17, In SonarQube enterprise version 10.5.1 Java 17 based projects are scanning fine but Java11 based projects are throwing error while scanning.
Hi @Ajaykumar,
I think it’s the other way around. Can you send me the scanner logs?
Hi @Bachri_Abdel ,
Please refer the scanner logs below,
Task :sonar FAILED
12:08:33
12:08:33 FAILURE: Build failed with an exception.
12:08:33
12:08:33 * What went wrong:
12:08:33 Execution failed for task ‘:sonar’.
12:08:33 > 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
12:08:33
12:08:33 * Try:
12:08:33 > Run with --stacktrace option to get the stack trace.
12:08:33 > Run with --info or --debug option to get more log output.
12:08:33 > Run with --scan to get full insights.
12:08:33 > Get more help at
https://help.gradle.org.
12:08:33
12:08:33 Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
12:08:33
12:08:33 You can use ‘–warning-mode all’ to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
12:08:33
12:08:33 For more on this, please refer to
Command-Line Interface
in the Gradle documentation.
12:08:33
12:08:33 BUILD FAILED in 47s
12:08:33 34 actionable tasks: 34 executed
@Ajaykumar,
I want to see the beginning of the log.
Can we have private thread for sharing the entire log?
Hi @Ajaykumar,
Yes
Hi @Bachri_Abdel,
Any update regarding private thread for sharing the entire log?
Hi @Bachri_Abdel ,
I have sent the sonar log in private threat, please review it.
As expected, the scanner is running on JDK 11
13:02:37 + java --version
13:02:37 openjdk 11.0.24 2024-07-16
13:02:37 OpenJDK Runtime Environment (build 11.0.24+8-post-Ubuntu-1ubuntu324.04.1)
13:02:37 OpenJDK 64-Bit Server VM (build 11.0.24+8-post-Ubuntu-1ubuntu324.04.1, mixed mode, sharing)
13:02:37 + ./gradlew sonar -x
Try to run it on JDK 17. You can set java_home before call the scanner, if you went to keep others steps on JDK11.
But our projects are java 11 based.
is there any work around to scan java 11 projects in latest sonar ?
Hi @Ajaykumar ,
The sonar-qube scanner uses classes compiled in java 17. You must absolutely run it with a JRE >=17.
No matter the java version of your project. This is not a problem.
Compile your project in the version of your choice.
You just need to change your java_home to 17 before the sonar scan.