Code coverage not shown in sonarcloud for a gradle based java application

Template for a good new topic, formatted with Markdown:

  • ALM used (GitHub and Azure DevOps)
  • CI system used (Azure DevOps)
  • Scanner command used when applicable (Azure DevOps tasks)
  • Languages of the repository Java
  • Only if the SonarCloud project is public, the URL
  • Coverage not seen in sonarcloud even though the report is present in the target location
  • Steps to reproduce - run gradle task using azure pipeline
  • Potential workaround

**2024-10-21T12:51:33.6988208Z 12:51:33.698 INFO Sensor JaCoCo XML Report Importer [jacoco]
2024-10-21T12:51:33.7010463Z 12:51:33.700 INFO Importing 1 report(s). Turn your logs in debug mode in order to see the exhaustive list.
2024-10-21T12:51:33.8054607Z 12:51:33.804 INFO Sensor JaCoCo XML Report Importer [jacoco] (done) | time=106ms
2024-10-21T12:51:33.8055715Z 12:51:33.804 INFO Sensor IaC CloudFormation Sensor [iac]

Task :processResources

Task :classes

Task :resolveMainClassName

Task :bootJar

Task :jar

Task :assemble

Task :compileTestJava

Task :processTestResources NO-SOURCE

Task :testClasses

Task :test

Task :jacocoTestReport

Task :check

Task :build

**

Hi,

I suspect something has been omitted here. The logs only offer an “exhaustive list” when the file paths in the report aren’t recognized by analysis.

You need to make sure the paths in the coverage report match the paths analysis is seeing.

 
HTH,
Ann