gpt4 book ai didi

java - 如何在 child 的 pom 中将 jacoco 覆盖率设置为 60%?

转载 作者:行者123 更新时间:2023-12-02 04:26:46 25 4
gpt4 key购买 nike

有人可以告诉我如何在 Child 的 POM 中将 Jacoco 代码覆盖率设置为一定百分比吗?我有一个 parent 依赖项,预计覆盖率为 80%。我需要在我的子项目中将其限制为 60%。我在 child 的 pom 属性下设置 0.600。但这并没有凌驾于家长 80% 的覆盖目标之上。任何评论表示赞赏..

<jacoco.percentage.instruction>0.600</jacoco.percentage.instruction>

最佳答案

关键是我们不能只覆盖 Jacoco 的属性。我已将以下父项的 pom 插件复制到我的项目中,并将最小覆盖率更新为 60%,而父项的 pom 中为 80%。这对我有用。

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.2</version>
<executions>
<execution>
<id>default-check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<limits>
<limit>
<counter>INSTRUCTION</counter>
<minimum>60.0%</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
<execution>
<id>default-audit-check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<haltOnFailure>false</haltOnFailure>
<rules>
<rule>
<limits>
<limit>
<counter>INSTRUCTION</counter>
<minimum>60.0%</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>jacoco.surefire.argLine</propertyName>
</configuration>
</execution>
</executions>
</plugin>

关于java - 如何在 child 的 pom 中将 jacoco 覆盖率设置为 60%?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56605337/

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