官方的exclude配置并不能起作用,参考:
https://issues.gradle.org/browse/GRADLE-2955
和
http://stackoverflow.com/questions/29887805/filter-jacoco-coverage-reports-with-gradle
apply plugin: 'java'
apply plugin: 'jacoco'
jacocoTestReport {
reports {
xml {
enabled true // coveralls plugin depends on xml format report
}
html {
enabled true
}
}
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it,
exclude: ['codeeval/**',
'crackingthecode/part3knowledgebased/**',
'**/Chapter7ObjectOrientedDesign**',
'**/Chapter11Testing**',
'**/Chapter12SystemDesignAndMemoryLimits**',
'projecteuler/**'])
})
}
}