gpt4 book ai didi

maven - jacoco:report-aggregate 要么得到浅层覆盖,要么根本没有

转载 作者:行者123 更新时间:2023-12-01 06:41:28 25 4
gpt4 key购买 nike

我有一个大型的多模块 Maven 构建,目前混合了 PowerMock 和 Mockito 测试(很快将所有 PowerMock 测试移动到 Mockito)。父 pom 中的默认 jacoco-maven-plugin 配置用于“离线”检测,但带有 Mockito 测试的一个模块正在使用在线检测。我相信模块中的每个 jacoco.exec 文件都是正确构建的。

其中一个名为“jacoco-aggregate”的子模块只是尝试使用“merge”和“report-aggregate”目标。我正在使用“合并”,因为我正在与 SonarQube 集成,而我们使用的版本将只允许一个 exec 文件。从我可以看到的输出中,“合并”目标似乎工作正常。

“报告聚合”目标似乎有问题。它目前根本没有产生任何报道。显示的表格是空的。

以下是我在 jacoco 子模块本身中构建时得到的当前输出:

[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-aggregate”pom 的摘录:
<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>

请注意,我正在为其他 jacoco 目标指定执行,因为这些是在父 pom 中指定的,预计将由普通代码模块使用。将“阶段”设置为“无”是一种有效禁用该目标的方法(并不是说它特别干净)。

在“jacoco-aggregate”中手动运行构建之前,我查看了其他模块中引用的几个“jacoco.exec”文件,它们都存在并且非空。

最佳答案

首先 - 看来你是 mergereport-aggregate 之后,所以最后一个看不到 jacoco.exec .

另请注意 report-aggregate调查 react 堆项目,即如果你有

root
\child_1
\child_2

然后在执行 mvn ... 期间在 root reactor 将包含所有 3 个,而在 cd child_2 && mvn ... 执行期间reactor 将仅包含 child_2 .

关于maven - jacoco:report-aggregate 要么得到浅层覆盖,要么根本没有,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42450322/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com