将JSP排除在报告之外

将JSP排除在报告之外

本文介绍了JaCoCo-将JSP排除在报告之外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在JaCoCo生成的Maven站点报告中,由于涵盖了我所有已编译的JSP(而且它们很长),因此覆盖范围很差.我在reporting中尝试了以下方法:

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>

prepare-package阶段的POM的build部分中,还有另一个外观类似的配置.这不会阻止JSP类包含在报告中.如何避免呢?

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?

推荐答案

那很容易.提示是,exclude标记已经引用了类dir.因此,您的xml片段应为:

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>

还要注意周围的excludes元素中的单个exclude标签!

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

这篇关于JaCoCo-将JSP排除在报告之外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 17:53