JDK mismatch issue in sonarqube

Hi,

We are currently running our sonar scans with the following gradle wrapper command.

./gradlew --no-daemon dependencyCheckAnalyze sonarqube -Dsonar.login=“admin” -Dsonar.password=“REMOVED” -Dsonar.branch.name=“develop” -Dorg.gradle.jvmargs=“-Xmx2048m” --refresh-dependencies

Our code base and wrapper is executing in as java17 code base. But the VM itself is on java 8 when we run this gradle command it is apearing to run the sonarqube dependency run as the VM java version which is java 8 which results in the following error message.

“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”

Is this the correct approach? Or should we be scanning these projects in a different way? And if this is the correct approach how can we move forward? We have some maven projects that get built and require java 8 so we cannot just update the java version on the vm itself.

We are running Sonarqube Enterprise - 9.8 (build 63668)

Hi,

Welcome to the community!

You do realize you can use later versions and compile “down to” older versions with the target flag, right?

 
Ann

Thanks for the reply.
Our current gradle version in gradle wrapper is targeted at version 17 and our jenkins server is using java 1.8 . We are executing the task using gradle wrapper. How else would we target that version specifically for only that task?

Hi,

You should run Jenkins with Java 17 and compile down if you need to. “How” is really a Gradle topic, so I’ll point you to the Gradle community

 
HTH,
Ann