9
votes

In the Maven site reports generated by JaCoCo, I get quite bad coverage because all of my compiled JSPs are included (and they are long). I tried the following in reporting:

<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <configuration>
        <exclude>target/classes/jsp/**/*.class</exclude>
    </configuration>
</plugin>

Another similar-looking configuration is in the build section of the POM for the prepare-package phase. That doesn’t stop the JSP classes from being included in the report. How to avoid that?

1

1 Answers

17
votes

That's quite easy. The clue is, that the exclude tag already references the classes dir. So your xml fragment should be:

<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <configuration>
        <excludes>
            <exclude>jsp/**/*.class</exclude>
        </excludes>
    </configuration>
</plugin>

Watch also the single exclude tag in the surrounding excludes element!