如何使用JaCoCo忽略内部/嵌套类? [英] How to ignore inner/nested classes with JaCoCo?

查看:218
本文介绍了如何使用JaCoCo忽略内部/嵌套类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试忽略一些生成的类,而这些类会被忽略。但是,如果这些类具有内部类,则尽管父类被排除在外,但这些类仍会包含在内。这是我的配置:

I'm trying to ignore some generated classes, and the classes get ignored fine. But if those classes have inner classes, those classes still get included, despite the parent class being excluded. This is my configuration:

<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <version>0.7.9</version>
    <executions>
        <execution>
            <goals>
                <goal>prepare-agent</goal>
            </goals>
        </execution>
        <execution>
            <id>report</id>
            <phase>prepare-package</phase>
            <goals>
                <goal>report</goal>
            </goals>
            <configuration>
                <excludes>
                    <exclude>**/*DB.*</exclude>
                    <exclude>**/*DTO.*</exclude>
                </excludes>
            </configuration>
        </execution>
    </executions>
</plugin>

尝试通过排除 *使用ParentClass.NestedClass的标准Java名称约定* / * DB。*。* 没有帮助。

Attempting to use the standard Java name convention of ParentClass.NestedClass by excluding **/*DB.*.* did not help.

推荐答案

经过一番搜索,我发现我自己回答。由于它不容易通过Google进行搜索,因此为了后代,将其放在此处:

After some searching, I found the answer myself. As it wasn't easily googleable, I'm putting it here for posterity's sake:

语法与 compiled Java命名约定的语法相同:

The syntax mirrors that of the compiled Java naming convention:

<configuration>
    <excludes>
        <exclude>**/*DB.*</exclude>
        <exclude>**/*DB$*.*</exclude>
        <exclude>**/*DTO.*</exclude>
        <exclude>**/*DTO$*.*</exclude>
    </excludes>
</configuration>

这篇关于如何使用JaCoCo忽略内部/嵌套类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆