3

Our java application has multiple source folders, and use build-helper-maven-plugin to read source files from all the folders, But here when I run clover on the application it generates the clover.xml with

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

All other metrics have numbers in it

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>

Why are few metrics 0, am I missing anything in the plugin settings.

Nishanth
  • 317
  • 4
  • 16

1 Answers1

0

It may by impacted a setting in your config includesAllSourceRoots: false

See docs: http://openclover.org/doc/maven/latest/instrumentInternal-mojo.html#includesAllSourceRoots

According to the docs in case it is set to false then only the main source root src/main/java will be used.

Zilvinas
  • 5,518
  • 3
  • 26
  • 26