I know how to ignore classes defined in their own .java
files, but not aware of how to ignore inner classes.
For example, I have class A with nested class B:
class A {
...
static class B {
...
}
}
jacocoTestReport
keeps checking the coverage when I want to ignore them in jacoco.gradle
file with this syntax(learned from this post: How to ignore inner/nested classes with JaCoCo?): (setFrom
part is for later versions of Gradle, where classDirectories = files()
is deprecated)
apply plugin: "jacoco"
jacoco {
toolVersion = "0.8.3"
}
jacocoTestReport {
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it,
exclude: [
"com/example/xxx/*",
"com/example/xxx/A\$.*B*"
])
}))
}
}
($
must be escaped, while in the post there is no need because he uses Maven when I use Gradle)
So, how can I ignore this inner class?