We are in the process of setting up java11 on our jenkins machines to run sonar scanner. We are following the instructions provided in https://sonarcloud.io/documentation/user-guide/move-analysis-java-11/ as our build runs on java8.
We have hard-coded system path that points to jdk1.8 in one of our internal pom parents and the scanning fails with below error when we run
$ mvn verify …
$ export JAVA_HOME=/path/to/java11
$ mvn sonar:sonar …
Failed to execute goal on project xxxxxxx_service: Could not resolve dependencies for project com.xyz:xxxxxx:pom:1.0-SNAPSHOT: Could not find artifact jdk.tools:jdk.tools:jar:1.8 at specified path /usr/lib/jvm/java-11-openjdk-amd64/…/lib/tools.jar
I tried adding
-Dsonar.java.binaries=**/build/classes but that didnt help.
Is there any other way to run sonar analysis in java11 for builds running in java8?