As I have been fighting with that issue of an aggregate POM not being able
to generate an aggregated coverage report over all listed modules exactly
as Michel, I still want to make sure I understood the mechanism correctly:
The goal report-aggregate does *not *work like this (when running e.g. mvn
clean test site on the aggregate POM):
- each mentioned module in the <modules> is run first, also generating
all jacoco.execs
- afterwards the aggregate module runs its own configured reports
(including jacoco:report-aggregate), generating and merging all coverage
reports from the <modules>
Intuitively, I would have expected the mechanism to work like that.
Instead, I think you're emphasizing that the general Maven concept of
aggregator POMs works differently and is not capable of realizing that
"ideal" scenario. Seems that the Maven aggregator POM is just good for
listing and running a couple of modules with one call and not for final
result collection... Am I right so far?
So how would you configure a separate report module like you mentioned? The
most important piece of information is obviously that the report-aggregate
goal does *not* use the <modules> list to gather coverage information from
but rather the <dependencies> list, right? So basically we would set up a
module with lots of "fake" dependencies?
That's what I thought would work at first ("report-aggregate" and
"aggregation POM" sounds like it just fits together... maybe the
jacoco-goal should better be "report-collection" or something to avoid
potential mixup...) but is obviously *wrong*:
<project ...>
<groupId>org.acme</groupId>
<artifactId>report-module</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<modules>
<module>../module-a</module>
<module>../module-b</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.7.201606060606</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site-aggregate</id>
<phase>prepare-package</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Is this the *way to go *then?
<project ...>
<groupId>org.acme</groupId>
<artifactId>report-module</artifactId>
<version>1.0</version>
<packaging>jar</packaging> <!-- instead of the aggregate 'pom' a default
module? -->
<dependencies>
<dependency>
<groupId>org.acme</groupId>
<artifactId>module-a</artifactId>
</dependency>
<dependency>
<groupId>org.acme</groupId>
<artifactId>module-b</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.7.201606060606</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site-aggregate</id>
<phase>prepare-package</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jacoco/afa8578d-cb48-452b-88ae-1578a965d117%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.