We are using SonarQube 9.7 Enterprise Edition (We will be upgrading to a newer version soon) on a k8s EKS cluster in a jenkins scripted pipeline. The project is a mono-repo, the maven file has modules defined.
The issue I have for this particular project, is that it is written in java 1.8 and the mvn sonar:sonar needs java 11 (and I believe java 17 with SonarQube 9.9). So we need to compile the code before we run mvn sonar at a later stage. How do I kick off mvn sonar:sonar without it trying to re-build or compile the project?
I tried passing in the param -Dsonar.java.binaries=GenericHandler/target/classes, but it still tries to rebuild everything.
I got it working fine with that property and the sonar-scanner cli. The issue I am trying to solve, is that this is a generic pipeline. There are some projects that are mono-repos and some that are just 1 project repos. Is there a way that the maven file needs to be written so the mvn sonar command picks up all of the class files?
I found this sample project, but not seeing how it would handle my scenario.
So when I run that command, it looks like it kicks everything off again to be re-built…
I came across this post that seems to have the same issue (unfortunately the link to the doc the post references, seems to be no longer valid. But I think it was trying to point to here to the “Jenkins” section)
I had to remove the clean and verify part of the command and add in my version. It also looks like you can pass in a -X at the end of maven to turn on debugging.