Take merged jacoco report into consideration for multimodule project

I have multi module maven project with 3 modules A,B and C.

When I generate jacoco coverage, I create one merged “jacoco.exec” file containing coverage for all the projects.

Project A uses projects B and C. It has all the tests. Project B and C have no tests. Since project A uses classes from B and C, merged “jacoco.exec” when loaded in intellij shows all classes to have 100% coverage.

The problem is with sonarqube - it seems that it requires to get one “jacoco.exec” report per project. So it shows coverage of 0% for B and C. Only project A has coverage of 100%.

Is it possible somehow to fix this, and use project A as source of coverage data for projects B and C?

What version of SonarQube are you using?

  • Enterprise Edition
  • Version 9.4 (build 54424)

I would suggest checking the Multi-module builds section of this Guide:

Keep in mind that SonarQube no longer pays attention to the .exec files – it is only capable of importing JaCoCo XML Reports.

I think I tried this also. It aggregates the report, but does not use it for coverage report stat inside separate projects.

I didn’t try to copy aggregated report to every single project though. But that seems like not proper thing to do.

Scrolling down a bit…

Did you do this as well?