JaCoCo - 从报告中排除JSP

Mic*_*fel 9 jsp maven jacoco

在JaCoCo生成的Maven站点报告中,由于我所有已编译的JSP都包含在内(并且它们很长),因此我的报道非常糟糕.我尝试了以下内容reporting:

<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <configuration>
        <exclude>target/classes/jsp/**/*.class</exclude>
    </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

另一个外观相似的配置在buildPOM的prepare-package相位部分.这并不能阻止JSP类包含在报告中.怎么避免呢?

mle*_*mle 17

这很容易.线索是,exclude标签已经引用了类dir.所以你的xml片段应该是:

<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <configuration>
        <excludes>
            <exclude>jsp/**/*.class</exclude>
        </excludes>
    </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

还要注意周围的单个排除标记排除元素!