Jacoco Coverage not reporting

136 views
Skip to first unread message

Mohan Reddy

unread,
Apr 14, 2020, 8:10:30 AM4/14/20
to JaCoCo and EclEmma Users
Hi Everyone,

I was trying to achieve the coverage report generation on sonarqube platform for one of our project. Below are the details.
1. I've a multi module (4 modules) maven project which has the junit test cases written for a single module. I use TeamCity as a CI tool to get the code compiled and perform the cpde coverage through Jacoco plugin (which was written on parent pom.xml file). 
2. Whenever I trigger a build, the sonarqube scan process gets started and coverage report doesnt get reflect on sonarqube platform. The build doesnt fail, but never shows the coverage report on sonarqube platform.
3. I've defined the properties on every module as well.
4. Below is the plugin details defined in parent pom.xml file and properties alonein child pom.xml files

---------------properties-child pom-----------
<properties>
<sonar.coverage.jacoco.xmlReportPaths>${basedir}/../${aggregate.report.dir}</sonar.coverage.jacoco.xmlReportPaths>
</properties>

---------------Plugin- parent pom------------------
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.4</version>
</plugin>
</plugins>
profiles>
<profile>
<id>coverage</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles> Can someone please let me know is there anything I'm missing to reflect the code coverage part ? I uses the sonarqube 7.9.1 version, the master branch was first analyzed. Below is the command I passes through TeamCity command - clean verify sonar:sonar Looking forward at your response. -Mohan

Evgeny Mandrikov

unread,
Apr 15, 2020, 7:25:55 AM4/15/20
to JaCoCo and EclEmma Users
First of all:
As stated in JaCoCo documentation ( https://www.jacoco.org/jacoco/trunk/doc/integrations.html ) integration with SonarQube is third-party and not developed by JaCoCo team.
And all questions about third-party integrations should be addressed to vendors of these integrations.

Nevertheless:
property "sonar.coverage.jacoco.xmlReportPaths" should point to XML file(s) with report(s), not to directory
in your pom.xml snippets there are no traces of https://www.jacoco.org/jacoco/trunk/doc/report-mojo.html that generates XML report

Mohan Reddy

unread,
Apr 16, 2020, 3:22:59 AM4/16/20
to jac...@googlegroups.com
Hi Evgeny,

Thank you for viewing and responding on the post. Lets remove the Integration of Jacoco with SonarQube. After taking a closer look at report I found there was challenge on the Jacoco xml file which contains only uncovered lines. The Jacoco xml file which got generated doesnt have anything or everything shows as counter covered as "Zero". Infact, I believe it should atleast have some values.

Following is the format the XML file looks as below with many fields, just as sample below:
<report name ="YYY">
   <group name = "ZZZ">
       <package name = "AAA">
           <class name = "BBB">
                <method name ="<init>" line="5" desc="()v">
                   <counter covered ="0" missed ="3" type ="INSTRUCTION"/>
                   <counter covered ="0" missed ="1" type ="LINE"/>
                   <counter covered ="0" missed ="1" type ="COMPLEXITY"/>
                   <counter covered ="0" missed ="1" type ="METHOD"/>

The index.html file looks as below with no metrics:
XYZ

element missed instruction cov Missed branches  Cov MissedCXty Missed Lines MissedMthods MissedClasses
XYZ                                          0%                                 0%   1037   1037   1642    1642    577      577       51        51

Hence, I feel Challenging part is with Jacoco, where not able to pick the coverage. Is this behaviour expectable or anything we need to consider for reporting the coverage. Any assistnace provided is greatly appreciated.


-Mohan Reddy

--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/7ba0324a-0588-4b26-ab7d-1192a9c825cd%40googlegroups.com.

Mohan Reddy

unread,
Apr 20, 2020, 2:11:00 AM4/20/20
to jac...@googlegroups.com
Hi There,

Is there anyone who have experienced the above problem where Jacoco was unable to create coverage report and shows everything has null metrics.


-Mohan

Evgeny Mandrikov

unread,
Apr 20, 2020, 4:51:24 AM4/20/20
to JaCoCo and EclEmma Users


On Monday, April 20, 2020 at 8:11:00 AM UTC+2, Mohan Reddy wrote:
Hi There,

Is there anyone who have experienced the above problem where Jacoco was unable to create coverage report and shows everything has null metrics.

There are already hundreds of messages in this mailing list with a similar question (https://groups.google.com/forum/#!forum/jacoco) and always it is due to an incorrect configuration on your side. 

When you don't provide access to your code or at least to complete executable example demonstrating your difficulty, please don't expect that people will waste their time on blind guesses what to change in your configuration.
 


-Mohan

To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages