Sending aggregated jacoco report to sonalcloud?

Hi,

We have a multi-module android project and we have successfully generated one aggregated coverage report from Jacoco. I am trying to send it to sonar cloud but we only see the coverage from the main app and not from the rest of the modules? even though we have specified the XML path which has the full coverage of the project including all modules.

    properties {
        property "sonar.host.url", "http://localhost:9000/"
        property "sonar.test.inclusions", "**/*Test*/**"
        property "sonar.sourceEncoding", "UTF-8"

        property "sonar.tests", ["src/test/kotlin"]
        property "sonar.sources", "src/main/kotlin"
        property "sonar.jacoco.reportPath", "**/jacoco/*.exec"
        property "sonar.coverage.jacoco.xmlReportPaths", "**/reports/jacoco/jacocoVariantNameTestReport/jacocoVariantNameTestReport.xml"
    }
}

Also tried specifying sources for individual subprojects but still we can see the coverage from the main app

    sonarqube {
        properties {
            property "sonar.sources", "src/main/kotlin"
            property "sonar.jacoco.reportPath", "**/jacoco/*.exec"

        }
    }
}

First of all, to make sure that the relevant teams notice your post, it’s good to optimize the tags on your post. I suggest to add jacoco, gradle and coverage tags. I suggest to remove sonarcloud and sonarqube tags when posting in the Get help / SonarClod category.

If I understand correctly, you managed to merge the coverage report of all modules into a single report file, and the analysis result on SonarCloud shows coverage only for the main app, and not for any of the other modules. If this is not correct, please clarify.

The first thing I would check is look inside the report file and make sure it really contains what you expect.

Then I would check the scanner output, if there are warnings related to importing the coverage report. A common problem for example is that the report file references file paths that don’t exist, The scanner output (./gradlew sonarqube ... --info) would show warnings for those.

I noticed that the official guide for importing jacoco coverage report mentions a link to handle multi-module projects that might also be helpful.