"No coverage information" in Github pull request comment for Java project

I have a public repository where SonarCloud is invoked via Github Actions, it is a Java project that relies on Maven. SonarCloud works well, but I am unable to integrate code coverage into its reports, nor do I see coverage details in the comment generated by the sonarcloud bot.

This is the pull request where I am experimenting with it, and this is the outcome:


Although the text says that coverage info is not available, I am sure that JaCoCo works, because if I upload the artifacts at the end of the pipeline - the files are there.

This is the relevant part of the CI pipeline:

  - name: Build and analyze
	  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
	  SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
	run: mvn -B verify sonar:sonar -Dsonar.projectKey=ralienpp_cmp-ra-component 
  - name: Upload artifacts for subsequent review
	uses: actions/upload-artifact@master
	 name: generated-reports
	 path: |

This is the sonar-related excerpt from my pom.xml:


And the jacoco settings:


The output of the job features these lines:

[INFO] Sensor JaCoCo XML Report Importer [jacoco]
[INFO] Importing 1 report(s). Turn your logs in debug mode in order to see the exhaustive list.
[INFO] Sensor JaCoCo XML Report Importer [jacoco] (done) | time=71ms

It seems that the jacoco report is there, it is detected and successfully imported. Nevertheless, I still cannot figure out why SonarCloud doesn’t “see” it. What troubleshooting steps can be applied to determine the root cause of the problem?

After sleeping on it, I figured out that nothing is wrong!

It seems that the analysis covers newly committed code, whereas the commit I was testing didn’t include any changes in .jar files, but rather configurations, pipelines, etc. I made a dummy commit where I added some .jar files with dummy lines - and Sonar did take coverage into account.

It is still a bit puzzling to me, because in the SonarCloud admin panel the definition of “new code” was set to cover stuff edited in the past 300 days. Maybe there is a misunderstanding on my side, but either way - I’m happy. This is what it looks like now:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.