0

The whole structure of application is like there a root pom, there are n number of modules and I have created one aggregator module. This is how my pom.xml for the aggregator sub module looks like.

<build>
  <plugins>
    <plugin>
      <groupId>org.jacoco</groupId>
      <artifactId>jacoco-maven-plugin</artifactId>
      <executions>
        <execution>
          <id>merge-reports</id>
          <phase>verify</phase>
          <goals>
            <goal>merge</goal>
          </goals>
          <configuration>
            <fileSets>
              <fileSet>
                <directory>..</directory>
                <includes>
                  <include>**/target/jacoco.exec</include>
                </includes>
              </fileSet>
            </fileSets>
            <destFile>${project.build.directory}/jacoco.exec</destFile>
          </configuration>
        </execution>
        <execution>
          <id>report-aggregate</id>
          <phase>verify</phase>
          <goals>
            <goal>report-aggregate</goal>
          </goals>
          <configuration>
            <dataFileIncludes>
              <dataFileInclude>**/jacoco.exec</dataFileInclude>
            </dataFileIncludes>
            <outputDirectory>${project.build.directory}/aggregated-report</outputDirectory>
          </configuration>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

Maven logs :

[INFO] Loading execution data file /Users/.....A...../target/jacoco.exec
[INFO] Loading execution data file /Users/.....B...../target/jacoco.exec
[INFO] Loading execution data file /Users/.....C...../target/jacoco.exec
[INFO] Loading execution data file /Users/.....D...../target/jacoco.exec
[INFO] Writing merged execution data to /Users/.....X..../target/jacoco.exec
[INFO] 
[INFO] --- jacoco-maven-plugin:0.8.8:report-aggregate (report-aggregate) @ reporting ---
[INFO] Loading execution data file /Users/.....X..../target/jacoco.exec
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

I am able to get merged jacoco.exec from my merge goal but while running report-aggregate goal, I am getting empty report.

Ashish khare
  • 110
  • 6

0 Answers0