0

I have a gradle project and I want to exclude some directories from TC coverage. 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?

Yogi
  • 1,035
  • 2
  • 13
  • 39

1 Answers1

0

afterEvaluate runs in Gradle's configuration phase which is before any tasks have executed and before any classes have been compiled (see build phases)

I'm guessing you want something like

test {
   jacoco {
      excludes = ['com/this/that/*'] 
   } 
} 
lance-java
  • 25,497
  • 4
  • 59
  • 101