I have Jenkins v1.651.1 and SonarQube Runner 2.4 and SonarQube Server 4.5.2.
The Jenkins job runs mvn clean test
to generate the .exec
report. My analysis properties (part of the Jenkins build) look something like this:
sonar.sources=myproj
sonar.tests=myproj/runtime/src/test
sonar.language=java
sonar.java.test.binaries=myproj/runtime/target/test-classes
sonar.java.test.libraries=myproj/runtime/target/admin/WEB-INF/lib/*.jar
sonar.java.binaries=myproj/runtime/target/classes
sonar.java.libraries=myproj/runtime/target/admin/WEB-INF/lib/*.jar
sonar.java.source=1.8
sonar.java.coveragePlugin=jacoco
sonar.sourceEncoding=UTF-8
sonar.jacoco.reportPath=myproj/target/jacoco.exec
sonar.junit.reportsPath=myproj/runtime/target/surefire-reports
The job completes successfully, but my Sonar dashboard looks like this and the job can't find the class files:
02:35:52.170 INFO - Sensor JaCoCoItSensor...
02:35:52.171 INFO - No JaCoCo analysis of project coverage can be done since there is no class files.
02:35:52.172 INFO - Sensor JaCoCoItSensor done: 2 ms
02:35:52.172 INFO - Sensor JaCoCoOverallSensor...
02:35:52.172 INFO - Sensor JaCoCoOverallSensor done: 0 ms
02:35:52.172 INFO - Sensor JaCoCoSensor...
02:35:52.172 INFO - No JaCoCo analysis of project coverage can be done since there is no class files.
02:35:52.172 INFO - Sensor JaCoCoSensor done: 0 ms
02:35:52.172 INFO - Sensor CPD Sensor (wrapped)...
02:35:52.172 INFO - JavaCpdEngine is used for java
Before marking as duplicate, please note that I've tried to set sonar.java.binaries
.
I've also verified that the .exec
file is there and when opening locally has the coverage values that I expect. Please help! Thanks.
Copied and pasted from http://stackoverflow.com/questions/42406185/sonarqube-jenkins-not-producing-unit-tests-coverage.