Is sonar use jacoco internally for code coverage?

Hi Team,

can any one help me understanding what technique used by SonarScanner for code coverage in general?



the documentation has

SonarSource analyzers do not run your tests or generate reports. They only import pre-generated reports.

The reports from coverage tools (Jacoco …) are consumed by Sonarqube.
It’s the same with other linters, see


Ok, if that is the case, even if I don’t include any of my test coverages which is by Jacoco still I can see some coverage reports by sonar on dashboard which quite different from my original jacoco one? Can anyone help me understand how sonar do the coverage report by itself absence of jacoco plugin ??

Hello @Tapas.nayak

I believe you will find answers in “executable line of code” documentation, especially the following:

Executable lines data is used to calculate missing test coverage for files that are not included in coverage reports. Ideally, executable line counts will be at or just under what coverage engines would calculate.

If you are not importing any coverage report, it will always result in 0% coverage. If it is not the case, it means that a report was imported in some way or another. I know that the Jacoco plugin is able to automatically import the report if everything is configured as expected, maybe it the case for you?

In addition, if the coverage is different than the one from Jacoco, it is possible that the report is missing some files (test files, other languages, …), and therefore using executable line as default, changing the total coverage.

To know exactly what is happening, you can have a look at the logs.
Hope this leads your research,