We have many Java projects whose new code coverage is not working. The coverage for new code is always --.
We have tried many things but nothing works: sonar.projectDate property with an ancient date, many different versions for jacoco and sonar maven plugins.
This problem doesn’t occur in all projects. It works on some of them. It seems to be a random behavior.
Versions details are:
- SonarQube 7.9.3 (build 33349)
- Java versions for projects: 7 and 8
- Jenkins version 2.235.1
Hi @efren.villamagua looks like it is a configuration issue if you are using “sonar.jacoco.reportPaths” on your pom.xml this has deprecated on SonarQube instead of that you can use " sonar.coverage.jacoco.xmlReportPaths " this will fix your issue .
For more update you can visit
What Sachidananda said applies to a version of the
Java Code Quality and Security plugin >= 6.1, it does not support anymore JaCoCo native format. In this case, see [Coverage & Test Data] Importing JaCoCo coverage report in XML format
So you should check the version of
Java Code Quality and Security in the SonarQube/Administration/Marketplace.
If the java plugin is < 6.1, it should not be related to the XML format, please run
mvn -X sonar:sonar and provide the logs between:
Sensor JaCoCo XML Report Importer [jacoco]
Sensor JaCoCo XML Report Importer [jacoco] (done)
Java Code Quality and Security version is 6.3.2
[INFO] 17:46:51.485 Sensor JaCoCo XML Report Importer [jacoco]
[DEBUG] 17:46:51.488 Reading report '/var/lib/jenkins/workspace/###########/target/site/jacoco/jacoco.xml'
[INFO] 17:46:51.536 Sensor JaCoCo XML Report Importer [jacoco] (done) | time=51ms
Coverage on New Code continues being “
Thanks in advance.
There’s no error in the logs, XML format is imported successfully, so the coverage information should be present in SonarQube.
Could you check that the
jacoco.xml report contains some covered instruction attributes
ci or some covered branch attributes
cb with a value different from zero (for example
And file names that are supposed be covered are referenced in the
jacoco.xml report (e.g.
If the report looks good but it is not imported, could try to reduce and anonymize one project that is not working and send us as a small reproducer?