sonar.coverage.jacoco.xmlReportPaths not showing code coverage but the deprecated sonar.jacoco.reportPaths shows code coverage

Has somebody made this work in SonarQube 8.1?

I have an Android Gradle multi-module project. What configuration of Jacoco is needed?

1 Like

@Alix please create a new topic describing your problem, include logs, what have you tried so far, etc…

Same here, multi module gradle java spring boot project in https://sonarcloud.io don’t show coverage. In my local sonarqube Version 7.3 (build 15553) works with:

subprojects {
    jacocoTestReport {
        getAdditionalSourceDirs().setFrom(files(sourceSets.main.allSource.srcDirs))
        getSourceDirectories().setFrom(files(sourceSets.main.allSource.srcDirs))
        getClassDirectories().setFrom(files(sourceSets.main.output))
        reports {
            html.enabled = true
            xml.enabled = true
            csv.enabled = false
        }
    }
}

and the root task:

task jacocoRootReport(type: JacocoReport) {
    dependsOn = subprojects.test
    getAdditionalSourceDirs().setFrom(files(subprojects.sourceSets.main.allSource.srcDirs))
    getSourceDirectories().setFrom(files(subprojects.sourceSets.main.allSource.srcDirs))
    getClassDirectories().setFrom(files(subprojects.sourceSets.main.output))
    getExecutionData().setFrom(files(subprojects.jacocoTestReport.executionData))
    reports {
        html.enabled = true
        xml.enabled = true
        csv.enabled = false
    }
}

Follow-up:

I have made this work. Solution:

Can anyone send me the sonar-jacoco-plugin link again?

Can you tell me where to add this plugin?

Welcome :slight_smile:

no need to add the sonar-jacoco plugin manually, it is shipped with Sonarqube.
i.e. for Sonarqube 9.5 on Windows

c:\sonarqube-9.5.0.56709\lib\extensions\sonar-jacoco-plugin-1.1.1.1157.jar

Gilbert