Hi,

your observations are correct. This the way how Maven works. Any goal in the aggregator project is executed *before* its modules therefore we cannot create a report here. Different Maven plugin use different workarounds here, we decided for a solution which follows the Maven semantics.

Your observation about report-aggregate is also correct, see goal documentation for details: http://www.eclemma.org/jacoco/trunk/doc/report-aggregate-mojo.html

Our integration tests contain a example project: https://github.com/jacoco/jacoco/tree/master/jacoco-maven-plugin.test/it/it-report-aggregate

Regards,
-marc




On 2016-07-13 11:54, Bernd Winter wrote:
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
[1].
For more options, visit https://groups.google.com/d/optout.


Links:
------
[1]
https://groups.google.com/d/msgid/jacoco/afa8578d-cb48-452b-88ae-1578a965d117%40googlegroups.com?utm_medium=email&utm_source=footer

--
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/78dd3df5a6663148af950cffffeae0ee%40mountainminds.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to