我使用Gradle JaCoCo插件,根据排除列表,一些文件夹必须从测试覆盖检查中排除。但是当我运行gradle sonar
时,所有这些文件夹都由Sonarcloud处理。
如何强制SonarCloud忽略这些文件夹?
jacocoTestReport {
dependsOn test
reports {
xml.required = true
html.required = true
}
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
'by/litvin/localsandbox/model/*',
'by/litvin/localsandbox/mapper/*',
'by/litvin/localsandbox/data/*',
'by/litvin/localsandbox/data/*',
'by/litvin/localsandbox/messaging/event/*',
'by/litvin/localsandbox/messaging/serializer/*',
'by/litvin/localsandbox/config/*',
'by/litvin/localsandbox/LocalSandboxApplication.*'
])
}))
}
}
1条答案
按热度按时间new9mtju1#
我找到了一个解决方案,JaCoCo排除列表是不够的,你需要在sonar插件配置中排除这些包: