英文:
Jacoco exclude class coverage report zero for only branch
问题
我正在尝试从我们的Jacoco报告中排除一个类。我在build.gradle文件中进行了以下操作:
jacocoTestReport {
dependsOn {
test
}
reports {
xml.enabled true
}
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
'**/DSApplication.class'
])
}))
}
}
这在排除“分支”覆盖范围方面效果良好,但其他选项(如“复杂性”或“行”)仍显示零覆盖率。
我该如何解决?
英文:
I am trying to exclude a class from our jacoco report.
I did the following in build.graddle file:
jacocoTestReport {
dependsOn {
test
}
reports {
xml.enabled true
}
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
'**/DSApplication.class'
])
}))
}
}
It works well for excluding it from "brunch" coverage but the rest options (like "complexity" or "line") are still showing zero coverage.
How can I fix that?
答案1
得分: 0
显然,在我们用于构建的SonarQube中,有一个选项可以使代码覆盖范围排除得当。
英文:
Apparently there is an option in SonarQube, with we use for build, that makes proper code coverage exclude.
专注分享java语言的经验与见解,让所有开发者获益!
评论