首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >具有多个源目录的Cover0%覆盖率+ build-helper-maven-plugin

具有多个源目录的Cover0%覆盖率+ build-helper-maven-plugin
EN

Stack Overflow用户
提问于 2018-02-06 02:27:23
回答 1查看 318关注 0票数 3

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

代码语言:javascript
复制
coveredelements = 0
coveredconditionals = 0 
coveredmethods = 0
coveredstatements = 0

所有其他指标都包含数字

pom.xml

代码语言:javascript
复制
<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,我在插件设置中遗漏了什么吗?

EN

回答 1

Stack Overflow用户

发布于 2019-04-18 01:42:32

It 可能会因配置includesAllSourceRoots: false中的设置受到影响而发生

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

根据文档,如果设置为false,则仅使用源码根src/main/java

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48629141

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档