gpt4 book ai didi

maven-plugin - Clover 0% Coverage with multiple source directories + build-helper-maven-plugin

转载 作者:行者123 更新时间:2023-12-05 07:37:20 24 4
gpt4 key购买 nike

我们的 java 应用程序有多个源文件夹,并使用 build-helper-maven-plugin 从所有文件夹中读取源文件,但是在这里,当我在应用程序上运行三叶草时,它会生成 clover.xml

coveredelements = 0
coveredconditionals = 0
coveredmethods = 0
coveredstatements = 0

所有其他指标都有数字

pom.xml

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/api/src/main/java</source>
<source>${basedir}/common/src/main/java</source>
<source>${basedir}/batch/src/main/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>clover-maven-plugin</artifactId>
<version>4.1.2</version>
<configuration>
<includesAllSourceRoots>false</includesAllSourceRoots>
<jdk>1.8</jdk>
<excludes>
<exclude>**/*DO.java</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>clover</id>
<phase>test</phase>
<goals>
<goal>instrument-test</goal>
<goal>clover</goal>
<goal>check</goal>
</goals>
<configuration>
<generateHtml>true</generateHtml>
<generateXml>true</generateXml>
<jdk>1.8</jdk>
<includesAllSourceRoots>false</includesAllSourceRoots>
<targetPercentage>75</targetPercentage>
</configuration>
</execution>
</executions>
</plugin>

为什么很少有指标为 0,是我在插件设置中遗漏了什么吗?

最佳答案

可能会影响您配置中的设置 includesAllSourceRoots: false

参见文档:http://openclover.org/doc/maven/latest/instrumentInternal-mojo.html#includesAllSourceRoots

根据文档,如果设置为 false,则 ma​​in 源根 src/main/java 将被使用。

关于maven-plugin - Clover 0% Coverage with multiple source directories + build-helper-maven-plugin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48629141/

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