简体   繁体   English

jacocoTest 排除无效

[英]jacocoTest exclusion has no effect

I have a gradle project and I want to exclude some directories from TC coverage.我有一个 gradle 项目,我想从 TC 覆盖范围中排除一些目录。 This is what I am giving in the task这就是我在任务中给出的

jacocoTestReport {
reports {
    xml.enabled true
    csv.enabled false
    html.enabled true
}

afterEvaluate {
    classDirectories.setFrom(files(classDirectories.files.collect {
        fileTree(dir: it).exclude(
            // define here
            'com/this/that'
        )
    }))
}

}

However the classes still shows up in the coverage.然而,这些类仍然出现在覆盖范围内。 What am I missing?我错过了什么?

afterEvaluate runs in Gradle's configuration phase which is before any tasks have executed and before any classes have been compiled (see build phases ) afterEvaluate在 Gradle 的配置阶段运行,该阶段在任何任务执行之前和任何类被编译之前(参见构建阶段

I'm guessing you want something like我猜你想要类似的东西

test {
   jacoco {
      excludes = ['com/this/that/*'] 
   } 
} 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM