问题描述
我在JaCoCo 0.8.0的Java项目中使用Gradle 4.4,SonarJava 5.0.1使用Sonar。
我有一个课程用lombok的 @Value
和 @Builder
。
我的JaCoCo配置build.gradle看起来像这样:
jacoco {
toolVersion =0.8.0
reportsDir =文件($ buildDir / reports / jacoco)
}
jacocoTestReport.doFirst {
classDirectories = files(buildDir / classes)
}
任务jacocoReport(类型:JacocoReport){
sourceSets sourceSets.main
executionData测试,integrationTest
}
另外,我有lombok.confi文件,属性 lombok.addLombokGeneratedAnnotation = true
,生成的东西实际上有 @ lombok.Generated
在build / classes中注释。
然而,Sonar的覆盖率仍然很低。它报告了大量的条件和行。 正如: b
$ b
截至今日(2018年1月29日)为止,修复应该是尚未发布的SonarJava插件5.1版本。
以上所有内容:由Gradle生成的报告应该已被过滤,由SonarQube生成的报告将在SonarJava升级后被过滤。
I'm using Gradle 4.4 on my Java project with JaCoCo 0.8.0, and Sonar with SonarJava 5.0.1.
I have a class annotated with lombok's @Value
and @Builder
.
My JaCoCo config in build.gradle looks like this:
jacoco {
toolVersion = "0.8.0"
reportsDir = file("$buildDir/reports/jacoco")
}
jacocoTestReport.doFirst{
classDirectories = files("buildDir/classes")
}
task jacocoReport(type: JacocoReport){
sourceSets sourceSets.main
executionData test, integrationTest
}
Also, I have lombok.confi file, with property lombok.addLombokGeneratedAnnotation = true
, and generated stuff does actually have @lombok.Generated
annotation in build/classes.
However, the coverage on Sonar is still low. It reports a ton of conditions and lines to cover.
As stated in announcement of release of JaCoCo version 0.8.0:
This is also stated in JaCoCo changelog:
As of today (29 Jan 2018) fix for https://jira.sonarsource.com/browse/SONARJAVA-2608 is supposed to be in not yet released SonarJava plugin version 5.1.
From all the above: report generated by Gradle should already be filtered, report generated by SonarQube will be filtered after upgrade of SonarJava.
这篇关于过滤Lombok,Gradle,Jacoco和Sonar的报道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!