我正在使用Jacoco v0.8.4 和Sonarcube v2.7.1


property "sonar.sources", "src/main/java"
property "sonar.binaries","build/intermediates/javac,app/build/tmp/kotlin-classes"
property "sonar.java.binaries", "build/intermediates/javac,app/build/tmp/kotlin-classes"
property "sonar.tests", "src/test/java" // where the tests are located
property "sonar.java.test.binaries", "build/intermediates/javac,app/build/tmp/kotlin-classes"
property "sonar.jacoco.reportPath", "build/jacoco/testDevDebugUnitTest.exec"
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.android.lint.report", "build/reports/lint results.xml"


SonarCube分析失败,原因是 sonar.java.binaries 的值无效
> No files nor directories matching 'app/build/tmp/kotlin-classes'
但是“app / build / tmp / kotlin-classes”存在于我的项目文件夹中。

但是,如果我从属性中删除kotlin事物,那么它将成功覆盖Java文件。

我对Kotlin的报道是否做错了?

最佳答案

您还需要在下面的路径中添加构建变体文件夹

property "sonar.java.test.binaries", "build/intermediates/classes/test/, app/build/tmp/kotlin-classes/<BuildVariant>UnitTest"
property "sonar.java.binaries", "build/intermediates/classes/<BuildVariant>/, app/build/tmp/kotlin-classes/<BuildVariant>/"
property "sonar.binaries", "build/intermediates/classes/<BuildVariant>/, app/build/tmp/kotlin-classes/<BuildVariant>/"

还有另一件事,请避免将文件名与lint results.xml等空格一起使用

07-24 09:45
查看更多