私は大規模なマルチモジュールMavenビルドを使用しています。現在、PowerMockテストとMockitoテストが混在しています。親pomのデフォルトのjacoco-maven-plugin設定は "オフライン"計測用ですが、Mockitoテストのあるモジュールはオンライン計測を使用しています。モジュールのjacoco.execファイルのそれぞれが正しくビルドされていると思います。jacoco:report-aggregateは、浅いカバレッジを取得するか、全く取得しません。
「jacoco-aggregate」と呼ばれる子モジュールの1つは、「マージ」と「レポート集約」の目標を使用しようとします。私はSonarQubeと統合しているので "merge"を使用しています。使用しているバージョンでは1つのexecファイルしか使用できません。私が見ることができる出力から、「マージ」目標は正しく動作しているようです。
「レポート集計」の目標には問題があるようです。現在のところ、カバレッジはまったく生成されていません。表示されるテーブルは空です。
<artifactId>jacoco-aggregate</artifactId>
<version>2.3.0-SNAPSHOT</version>
<name>jacoco-aggregate</name>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>com.att.detsusl</groupId>
<artifactId>usl-account-impl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.att.detsusl</groupId>
<artifactId>usl-core-impl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.att.detsusl</groupId>
<artifactId>usl-creditcheck-impl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.att.detsusl</groupId>
<artifactId>usl-csi-jaxb-base</artifactId>
<version>2.3.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.att.detsusl</groupId>
<artifactId>usl-ordercreation-impl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.att.detsusl</groupId>
<artifactId>usl-payment-impl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.att.detsusl</groupId>
<artifactId>usl-productandoffer-impl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.att.detsusl</groupId>
<artifactId>usl-servicefactory-impl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.att.detsusl</groupId>
<artifactId>usl-csi-icas-impl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.8</version>
<executions>
<execution>
<id>report-aggregate</id>
<phase>verify</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
</execution>
<execution>
<id>merge</id>
<phase>verify</phase>
<goals>
<goal>merge</goal>
</goals>
<configuration>
<fileSets>
<fileSet>
<directory>${project.basedir}/../usl-account-impl/target</directory>
<includes>
<include>*.exec</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/../usl-core-impl/target</directory>
<includes>
<include>*.exec</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/../usl-creditcheck-impl/target</directory>
<includes>
<include>*.exec</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/../usl-csi-jaxb-base/target</directory>
<includes>
<include>*.exec</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/../usl-ordercreation-impl/target</directory>
<includes>
<include>*.exec</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/../usl-payment-impl/target</directory>
<includes>
<include>*.exec</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/../usl-productandoffer-impl/target</directory>
<includes>
<include>*.exec</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/../usl-servicefactory-impl/target</directory>
<includes>
<include>*.exec</include>
</includes>
</fileSet>
</fileSets>
</configuration>
</execution>
<execution>
<id>prepare-agent</id>
<phase>none</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-instrument</id>
<phase>none</phase>
<goals>
<goal>instrument</goal>
</goals>
</execution>
<execution>
<id>default-restore-instrumented-classes</id>
<phase>none</phase>
<goals>
<goal>restore-instrumented-classes</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>none</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
注:
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ jacoco-aggregate ---
[INFO] Deleting <myhome>\git\oce_usl\usl-parent\jacoco-aggregate\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (filter) @ jacoco-aggregate ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory <myhome>\git\oce_usl\usl-parent\jacoco-aggregate\src\main\resources
[INFO]
[INFO] --- depends-maven-plugin:1.2:generate-depends-file (generate-depends-file) @ jacoco-aggregate ---
[INFO] Created: <myhome>\git\oce_usl\usl-parent\jacoco-aggregate\target\classes\META-INF\maven\dependencies.properties
[INFO]
[INFO] --- jacoco-maven-plugin:0.7.8:report (default-report) @ jacoco-aggregate ---
[INFO] Skipping JaCoCo execution due to missing execution data file.
[INFO]
[INFO] --- maven-javadoc-plugin:2.10.4:jar (module-javadoc-jar) @ jacoco-aggregate ---
[INFO] Not executing Javadoc as the project is not a Java classpath-capable package
[INFO]
[INFO] --- jacoco-maven-plugin:0.7.8:report-aggregate (report-aggregate) @ jacoco-aggregate ---
[INFO]
[INFO] --- jacoco-maven-plugin:0.7.8:merge (merge) @ jacoco-aggregate ---
[INFO] Loading execution data file <myhome>\git\oce_usl\usl-parent\jacoco-aggregate\..\usl-account-impl\target\jacoco.exec
[INFO] Loading execution data file <myhome>\git\oce_usl\usl-parent\jacoco-aggregate\..\usl-core-impl\target\jacoco.exec
[INFO] Loading execution data file <myhome>\git\oce_usl\usl-parent\jacoco-aggregate\..\usl-creditcheck-impl\target\jacoco.exec
[INFO] Loading execution data file <myhome>\git\oce_usl\usl-parent\jacoco-aggregate\..\usl-ordercreation-impl\target\jacoco.exec
[INFO] Loading execution data file <myhome>\git\oce_usl\usl-parent\jacoco-aggregate\..\usl-payment-impl\target\jacoco.exec
[INFO] Loading execution data file <myhome>\git\oce_usl\usl-parent\jacoco-aggregate\..\usl-productandoffer-impl\target\jacoco.exec
[INFO] Writing merged execution data to <myhome>\git\oce_usl\usl-parent\jacoco-aggregate\target\jacoco.exec
[INFO]
次は「jacoco集約」ポンポンからの抜粋です:
は、次のjacoco子モジュール自体に構築するとき私が得る電流出力であります他のjacocoゴールの実行を指定しているのは、それらが親のpomで指定されているからです。通常のコードモジュールで使用されることが予想されます。 「フェーズ」を「なし」に設定すると、その目標を効果的に無効にすることができます(特にクリーンではありません)。
"jacoco-aggregate"で手動でビルドを実行する前に、他のモジュールで参照されているいくつかの "jacoco.exec"ファイルを調べましたが、それらはすべて存在していて空ではありません。