Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JaCoCo - exclude JSP from report

Tags:

jsp

maven

jacoco

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?

like image 648
Michael Piefel Avatar asked Feb 04 '13 07:02

Michael Piefel


1 Answers

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!

like image 84
mle Avatar answered Sep 18 '22 15:09

mle