SonarCloud Code Analysis failed due to coverage on new code is 0.0%

Hi, I have the problem with SonarCloud analysis and I don’t know how to fix it.

I get these following in SonarScanner in Github

  • INFO: Sensor JaCoCo XML Report Importer [jacoco]
  • INFO: ‘sonar.coverage.jacoco.xmlReportPaths’ is not defined. Using default locations:target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
  • INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer

Please help. Thank you

Hi @Pinny, welcome to the community forum

It seems the coverage report is not found on the standard locations.
The file must be generated before the sonar scanner is executed. It means the test must run before the Sonar analysis, and generate the coverage file. It means, the build pipeline must have a step like mvn test, gradle build, etc. before the SonarScanner execution, or the command executing the scan must trigger the test first.
To help you further on that, I would need your complete build pipeline definition, or the command you use to trigger the scan, depending of the analysis method you use.


1 Like