Jacoco merged report shows 0% code coverage

52 views
Skip to first unread message

bpmme...@gmail.com

unread,
Feb 14, 2019, 3:35:53 AM2/14/19
to JaCoCo and EclEmma Users
I'm trying to merge some exec files and after that generate a code coverage report (html, xml, csv). But when I use my merged .exec file and generate the report with the classes, the report shows all 0% code coverage.

When I use single exec file I'm merging and create the report, it will show some coverage (6%).

Pls, help me to find a solution.

This is my pom.xml file.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>pramodya</groupId>
<artifactId>codecoverage</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<url>http://pramodya.org</url>

<build>
<directory>${project.basedir}/target</directory>
</build>

<profiles>
<profile>
<id>with-tests</id>
<activation>
<property>
<name>!maven.test.skip</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-jacoco-dependencies</id>
<phase>compile</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
<includeTypes>jar</includeTypes>
<includeArtifactIds>org.jacoco.ant</includeArtifactIds>
<stripVersion>true</stripVersion>
</configuration>
</execution>
</executions>
</plugin>

<!-- Ant plugin - Merge Jacoco Reports -->
<!-- Logging and distribution modules are not checked since not relevant -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target xmlns:jacoco="antlib:org.jacoco.ant">
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="${project.build.directory}" />
</taskdef>

<jacoco:merge destfile="merged.exec">
<fileset dir="jacoco" includes="*.exec"/>
</jacoco:merge>

<jacoco:report>
<executiondata>
<file file="merged.exec"/>
<!--<file file="jacoco/master/jacoco.exec"/>-->
</executiondata>
<structure name="Final Coverage Report">
<classfiles>
<fileset dir="class_files/classes/"/>
</classfiles>
</structure>
<html destdir="report/" />
<xml destfile="report/coverage-report.xml"/>
<csv destfile="report/coverage-report.csv"/>
</jacoco:report>
</target>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.ant</artifactId>
<version>${jacoco.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<dependencies>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.ant</artifactId>
<version>${jacoco.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<properties>
<jacoco.version>0.7.9</jacoco.version>
</properties>

</project>

Marc Hoffmann

unread,
Feb 14, 2019, 12:15:39 PM2/14/19
to jac...@googlegroups.com
Hi,

maybe the merge task does not find the execution data files and therefore dows create an empty exec file? You filter is

> <fileset dir="jacoco" includes="*.exec"/>


but you exec files seems to be located in a subdirectory:

> jacoco/master/jacoco.exec


So probably it should read includes=“**/*.exec”?

The merge task logs "Loading execution data file …” for each file which is merged. Check your your logs for this.

Regards,
-marc
> --
> 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/79049c4f-4f18-4af6-b5d9-aace24399ab8%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages