jacoco.exec 未使用 maven surefire 2.19.1

问题描述

我正在使用带有 springboot 2.3.x 应用程序的空手道 0.9.6 版本,它是一个 maven 多模块项目。

使用surefire,我可以使用带有少量-D 参数的mvn clean install 运行测试用例。 此外,作为 jUnit 运行的测试类(使用 jUnit4)工作正常。

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.19.1</version>
    <configuration>
        <useSystemClassLoader>false</useSystemClassLoader>                
    </configuration>               
</plugin>

但是我在生成 jacoco 覆盖率报告时遇到了困难。 jacoco.exec 没有生成。 我可以看到所有和单个模块的万无一失的报告正在成功生成。 这就是它所说的。

argLine set to -javaagent:C:\\Users\\xxx\\.m2\\repository\\org\\jacoco\\org.jacoco.agent\\0.8.3\\org.jacoco.agent-0.8.3-runtime.jar=destfile=C:\\Users\\xxx\\git\\my-project\\my-controller-module\\target\\jacoco.exec

Reactor Summary for top-risk-inventory 0.0.1-SNAPSHOT:
[INFO] 
[INFO] my-inventory ................................. SUCCESS [  6.432 s]
[INFO] my-common ......................................... SUCCESS [ 13.602 s]
[INFO] my-domain ......................................... SUCCESS [ 17.378 s]
[INFO] my-service-layer .................................. SUCCESS [ 17.783 s]
[INFO] my-controller-module ..................................... SUCCESS [03:42 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  04:38 min
[INFO] Finished at: 2021-05-16T20:44:07+05:30
[INFO] ------------------------------------------------------------------------

注意:我已经完成了与@{argLine} 相关的更改,但对我没有任何作用。另一个发现是surefire 2.2.1与我的其他一些依赖项不兼容,因此使用2.19.1

感谢您的快速建议。

解决方法

也许您可以从我们的实施中获得一些信息?

https://github.com/kirksl/karate-maven-gradle