Unit test has 70% coverage but sonar has 0% coverage

Please see belwo. My sonarqube stage in the CI is reporting 0% coverage even though my unit tests have enough coverage. Please help

Hey there.

  • As requested in the template post, what version of SonarQube are you using?
  • What do the logs about coverage reports say?


The problem is seen here:

WARN: No coverage report can be found with sonar.coverage.jacoco.xmlReportPaths=‘target/jacoco.exec,target/jacoco-it.exec’. 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

The “xmlReportPaths” property should point to the “jacoco.xml” file. The exec format is obsolete, I believe.