ALM used (GitHub, Bitbucket Cloud, Azure DevOps)
CI system used (Bitbucket Cloud, Azure DevOps, Travis CI, Circle CI)
Scanner command used when applicable (private details masked)
Azure Pipeline YAML
trigger: - main pool: vmImage: 'ubuntu-latest' steps: - task: SonarCloudPrepare@1 inputs: SonarCloud: REDACTED organization: REDACTED scannerMode: 'Other' - task: Maven@3 inputs: mavenPomFile: 'pom.xml' publishJUnitResults: true testResultsFiles: '**/surefire-reports/TEST-*.xml' codeCoverageToolOption: 'JaCoCo' javaHomeOption: 'JDKVersion' jdkVersionOption: '1.11' mavenVersionOption: 'Default' mavenAuthenticateFeed: false effectivePomSkip: false sonarQubeRunAnalysis: true isJacocoCoverageReportXML: true sqMavenPluginVersionChoice: 'latest' - task: SonarCloudPublish@1 inputs: pollingTimeoutSec: '300'
Languages of the repository
Only if the SonarCloud project is public, the URL
- And if you need help with pull request decoration, then the URL to the PR too
Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
In a Maven multimodule project, SonarCloud is only reporting the last module as having code coverage, all other modules is reported as having 0% code coverage.
A similar issues appears to have been reported here Incomplete Jacoco code Coverage in multimodule maven project with no solution by member @DevonBritton
- Steps to reproduce
I created the following multimodule project
<modules> <module>child1</module> <module>child2</module> <module>report</module> </modules>
Child 1 and Child 2 each has a class with a unit test. Report module is used to assist local developers to generate JaCoCo reports, but has the following properties
<properties> <sonar.skip>true</sonar.skip> </properties>
SonarCloud only displays that Child 2 has 100% code coverage, and that Child 1 has 0% code coverage, even though the downloaded reports from Azure artifacts shows 100% code coverage for both modules.
Testing to ensure that it is not the Child 1 module that has any issues, I created the following module configuration
<modules> <module>child2</module> <module>child3</module> <module>report</module> </modules>
SonarCloud now displays that Child 3 has 100% code coverage, and that Child 2 has 0% code coverage, even though the downloaded reports from Azure artifacts shows 100% code coverage for both modules.
I seems to appear that the reports send or getting processed by SonarCloud is only processing the last module for code coverage.
I can provide debugging logs from Azure DevOps as well as the minimal project in a DM to a SonarSource team member.