I’m using sonarqube9.1
Trying to scan java 8 project with sonarqube.
After analysing the previous blogs, i found that there are two steps
- Build the Java 8 with jdk 8
- Do sonar analysis with jdk 11
I did the same
But we have some code snippet like this
import javafx.util.Pair; in our codebase
which is not supported in java 11.
Because of which , 2nd step sonar scan is not happening?
Is there any workaround for this?
Is my understanding right?
What error are you facing when you try?
In the second step, my command is ‘gradle sonarqube’ with jdk 11 set on the path, the below lines are the error for me . It looks like this step is also compiling again it seems
> Task :spring-backend:compileJava FAILED
FAILURE: Build failed with an exception.
Execution failed for task ‘:spring-backend:compileJava’.
Compilation failed; see the compiler error output for details.
Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output. Run with –scan to get full insights.
I would suggest explaining the steps you take to switch the JDK used, as well as what commands you’re running. Ideally if
gradle build was run with Java 8, running
gradle sonarqube with Java 11 won’t cause a recompilation.