Clover 0%覆盖多个源目录+ build-helper-maven-plugin

问题描述 投票:2回答:1

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

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

所有其他指标都包含数字

pom.hml

<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,我在插件设置中遗漏了什么。

maven-plugin clover build-helper-maven-plugin
1个回答
0
投票

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

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

根据文件,如果设置为false,那么将只使用主要来源src/main/java

© www.soinside.com 2019 - 2024. All rights reserved.