Hi there,
I've switched over to the sonarqube plugin but I have had difficulty producing coverage reports from JaCoCo.
It appears that the sonar.jacoco.reportPath is ignored and (guess) the default maven 'target/jacoco.exec' path is used instead.
When sonar.jacoco.reportPath is left unset and test.jacoco.destinationFile is left unset, the build will not analyse coverage data.
With sonar.jacoco.reportPath set to ${project.buildDir}/jacoco/test.exec and test.jacoco.destinationFile is left unset, the build will not analyse coverage data.
With sonar.jacoco.reportPath set to anything and test.jacoco.destinationFile set to target/jacoco.exec, the coverage is analysed.
The following demonstrated best, with reportPath explicitly set to the jacoco default and destinationFile set to the undocumented (maven?) sonarqube location. This configuration will analyse the coverage data.
sonarqube {
properties {
property "sonar.jacoco.reportPath", "${project.buildDir}/jacoco/test.exec" // this is the default as documented
property "sonar.log.level", "trace"
property "sonar.verbose", "true"
}
}
for the coverage analysis to occur, the test { jacoco { destinationFile } } has to be overriden:
test {
jacoco {
append = true
destinationFile = file("target/jacoco.exec")
classDumpFile = file("$buildDir/jacoco/classdumps")
}
}
And gives the following outputs:
...
Sonarqube property: sonar.jacoco.reportPath=/home/cpoll/Development/DevOps/Jenkins/sonarqube-gradle-test/build/jacoco/test.exec
...
16:45:15.077 INFO - Sensor JaCoCoSensor...
16:45:15.079 INFO - Checking binary directory: /home/cpoll/Development/DevOps/Jenkins/sonarqube-gradle-test/build/classes/main
16:45:15.079 INFO - Analysing /home/cpoll/Development/DevOps/Jenkins/sonarqube-gradle-test/target/jacoco.exec
16:45:15.123 INFO - Sensor JaCoCoSensor done: 46 ms
16:45:15.123 INFO - Sensor JaCoCoOverallSensor...
...
Whereas the combination of
destinationFile = file("${project.buildDir}/jacoco/test.exec")
property "sonar.jacoco.reportPath", "${project.buildDir}/jacoco/test.exec"
fails to do the coverage analysis (the Sensor JaCoCoSensor section is absent in the output and coverage data missing from uploaded analysis run)
Using
sonar 5.0
sonarqube 1.0
gradle 2.3
groovy 2.4.3
I've created a repo to show this in action:
hope this helps and good work on gradle and groovy support!
thanks
Chris