Jacoco - Test Coverage not showing up

  • Enterprise Edition
  • Version 9.9.1 (build 69595)

Greetings,

My project (shown below as my_company_project) is showing a strange behaviour regarding its coverage status, usually, when a test cov. report is not found, the analysis shows 0% for test coverage, however, ours’ is not showing anything! (image 1) Even though our log says something is being imported:

[2024-07-04T14:10:12.521Z] [INFO] Coverage report doesn't exist for pattern: 'build/reports/jacocoTestReport/jacocoTestReport.xml'
[2024-07-04T14:10:12.521Z] [INFO] Coverage report doesn't exist for pattern: 'build/reports/jacoco/test/jacocoTestReport.xml'
[2024-07-04T14:10:12.521Z] [INFO] Coverage report doesn't exist for pattern: 'target/site/jacoco-aggregate/jacoco.xml'
[2024-07-04T14:10:12.521Z] [INFO] Importing 1 report(s). Turn your logs in debug mode in order to see the exhaustive list.
[2024-07-04T14:10:12.521Z] [INFO] Sensor JaCoCo XML Report Importer [jacoco] (done) | time=8ms

The SonarScanner command does not contain an exclusion that would justify this behaviour:

[2024-07-04T14:09:47.732Z] + mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar -Dmaven.clean.skip=true -Dsonar.java.source=11 -Dsonar.coverage.exclusions=**/*domain*/**,**/*config*/**,**/generated-sources/** -Dsonar.sources=src/main -Dsonar.exclusions=**/wsdl/** -Dsonar.cpd.exclusions=**/*.sql -Dsonar.projectKey=my_company_project -Dsonar.projectName=my_company_project -Dsonar.projectVersion=my_company_project_version

Why does the coverage data is not showing up?



This warning showed up too, does it affect this behavior?

Cheers!

Hey there.

Just for giggles, what happens if you remove sonar.coverage.exclusions entirely?

I would also suggest you open up the JaCoCo XML report (run mvn sonar:sonar -X to be sure you’re opening the one that’s being read in)

Is the content as expected? Do you see the files that are represented in SonarQube, and does the report say there are lines that can be covered?