Sonarqube没有同时接受Kotlin和Java Coverage gradle项目 [英] Sonarqube not picking up both Kotlin and Java Coverage gradle project
问题描述
这不是不是的具有混合源Java和Kotlin的android项目. 尽管许多人在覆盖范围,kotlin和声纳方面存在问题.在这种情况下,我没有找到一个.
This is not an android project with mixed source Java and Kotlin. Eventhough many have had issues with coverage, kotlin and sonar. I didn't find one for this case.
Sonarqube没有同时获得Jacoco生成的Kotlin和Java Coverage:
Sonarqube is not picking up both Kotlin and Java Coverage generated by Jacoco:
- 4.8级
- Java 1.8
- 科特林1.3.50
它得到了Java语言,但是所有Kotlin类都被忽略了. 我已经在gradle文件中应用了所有必需的插件:
It gets the Java one, but all of the Kotlin classes gets ignored. I have applied all required plugin in the gradle file:
allprojects {
apply plugin: 'jacoco'
apply plugin: 'java'
apply plugin: 'org.sonarqube'
apply plugin: 'kotlin'
...
}
推荐答案
首先请确保您的jacocoTestReport
创建xml报告:
First make sure your jacocoTestReport
creates a xml report:
jacocoTestReport {
reports {
xml {
enabled true
}
xml.destination "build/reports/jacocoTestReport.xml"
}
}
然后您将需要对所有项目使用sonaqube中的xmlReportPaths
属性将这些xml报告强制进入声纳.
Then you will need to force those xml reports into sonar using the xmlReportPaths
property in sonaqube for all projects.
在这里您可以看到多个路径,以防万一您的项目中有多个子项目,而这些子项目也具有混合的Java/Kotlin源.
You can see multiple paths here, that's in case you have multiple sub projects in your projects which also have mixed source Java / Kotlin.
sonarqube {
properties {
property "sonar.java.coveragePlugin", "jacoco"
property("sonar.coverage.jacoco.xmlReportPaths", "../../build/reports/jacocoTestReport.xml,../build/reports/jacocoTestReport.xml")
}
}
借助该声纳,将考虑所有xml报告并生成整个覆盖范围.
With that sonar will consider all the xml reports and generate the whole coverage.
这篇关于Sonarqube没有同时接受Kotlin和Java Coverage gradle项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!