Incomplete code Coverage in multimodule maven project

Hello,

I am trying to get SonarQube to register integration test coverage on a big and messy Maven multi-module project. It seems to only register coverage of Java classes in the same module where the test is run.

I have configured the jacoco-maven-plugin in multiple ways, currently setting it in the pom.xml of the module where the integration test is run. It has the prepare-agent goal set and the report-aggregate goal in the verify phase. I am running it in debug mode with -X.

The jacoco.xml has the expected coverage data. For example, a specific Java class/method has coverage data.

<method name="&lt;init&gt;" desc="()V" line="15">
<counter type="INSTRUCTION" missed="0" covered="3"/>

I set up the pom.xml and the jacoco.xml with the coverage I checked, and it gets uploaded.

[INFO] Importing 1 report(s). Turn your logs in debug mode to see the exhaustive list.
[DEBUG] Reading report '/home/jenkins/workspace/xxx/target/site/jacoco/jacoco.xml'
[INFO] Sensor JaCoCo XML Report Importer [jacoco] (done) | time=25ms

But I am still getting 0% coverage on SonarQube outside the module where the test is running. I am running out of ideas. Note that I do not have administrative access to Jenkins (CI pipeline) or SonarQube.

I think I am not crazy (yet). I am actually looking at the correct SonarQube project; I checked, and the analysis time checks out.

Any ideas on what could be going on here? Is there any way I can check without a doubt (and without admin access) that it is some sort of misconfiguration?

Using Java 17, JaCoCo 0.8.12, and SonarQube server 9.9.3.

Help?

Hi,

First, this is a community. There are no SLAs.

Regarding your coverage question, it’s not explicit in the docs (likely because this is a JaCoCo thing?) but I believe it’s par for the course to only get the coverage of the classes in the same module. That said, it might be worth trying to aggregate the report up to the parent level to see if you get better results that way.

 
HTH,
Ann

Hi.

I think I finally close to getting it, if my intel is correct, can you guys (and/or gals) update the page of the aggregate the report up to the parent level ?

Seems that (at least for this project, might some specific on Sonar DevOps side) every one of dependency modules integrated test test needs explicitly set only to the same jacoco-aggregate/jacoco.xml with the sonar.coverage.jacoco.xmlReportPaths property at pom.xml. Not just the top level pom.xml.

Hi,

Sorry, but I’m not understanding.

 
Ann