Multiple paths in sonar.jacoco.reportpath Multiple paths in sonar.jacoco.reportpath jenkins jenkins

Multiple paths in sonar.jacoco.reportpath


You need to merge your JaCoCo .exec files into a single binary file.

To achieve this use JaCoCo's merge mojo.

Cristian (from cristian.io) has an excellent walkthrough of how to achieve this here. The following is a slightly modified version of the code from that blog post.

def allTestCoverageFile = "$buildDir/jacoco/allTestCoverage.exec"task jacocoMergeTest(type: JacocoMerge) {  destinationFile = file(allTestCoverageFile)  executionData = project.fileTree(dir: '.', include:'**/build/jacoco/test.exec')}sonarqube {  properties {    property "sonar.projectKey", "your.org:YourProject"    property "sonar.projectName", "YourProject"    property "sonar.jacoco.reportPath", allTestCoverageFile  }}