Please provide compiled classes of your project with sonar.java.binaries
You're running your Maven steps in the wrong order:
clean
- delete all previous build outputsonar:sonar
- run analysis (which requires build output)deploy
- build &etc...
Try this instead:
mvn clean deploy sonar:sonar
Now if you're about to object that you don't want to actually "deploy" the jar until/unless the changed code passes the Quality Gate, well... that requires a different workflow:
mvn clean package sonar:sonar// check quality gate status// if (qualityGateOk) { deploy }
The particulars of those last two steps will depend on your CI infrastructure. But for Jenkins, step #2 is well documented
I got the same error while invoking Standalone SonarQube Analysis as a Jenkins job pre-build step, which I fixed adding sonar.java.binaries=**/target/classes
along with other SonarQube Analysis properties, as follows:
sonar.projectKey=TEST-PROJECTsonar.projectName=TEST-PROJECTsonar.projectVersion=1.0sonar.sources=src/main/java/sonar.language=javasonar.java.binaries=**/target/classes
I had a seme problem. I did below stepsAdded Invoke top-level maven target from build steps (It should be the first build step)added clean install.
and also added below properties to my Analysis properties under Execute SonarQube scanner.
sonar.projectVersion=1.0sonar.sources=src/main/javasonar.sourceEncoding=UTF-8sonar.language=javasonar.java.binaries=target/classes