JaCoCo - exclude JSP from report

*爱你&永不变心* 提交于 2020-01-02 01:20:24

问题


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:


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!



来源:https://stackoverflow.com/questions/14682389/jacoco-exclude-jsp-from-report

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!