我有一个多模块gradle项目。我的模块之一的测试在单独的模块中。例如:ProjectA,ProjectATest1,ProjectATest2,ProjectATest3。在测试项目中将创建Jacoco执行报告。我想对ProjectA进行声纳分析,但声纳无法找到jacoco文件。
在ProjectA中,声纳属性,我给出了
sonarqube{
properties {
property "sonar.jacoco.reportPaths","ProjectATest1/gradleBuild/jacoco/Tests.exec", "ProjectATest2/gradleBuild/jacoco/Tests.exec", "ProjectATest3/gradleBuild/jacoco/Tests.exec"
}
}
但是我得到了这个异常
找不到参数的方法property() [sonar.jacoco.reportPaths,“ ProjectATest1 / gradleBuild / jacoco / Tests.exec”, “ ProjectATest2 / gradleBuild / jacoco / Tests.exec”, “ ProjectATest3 / gradleBuild / jacoco / Tests.exec”]
SonarQube: Coverage incomplete on multimodule gradle project with JaCoCo答案表明它应该起作用。声纳gradle插件中有bug吗?
答案 0 :(得分:1)
找不到参数的方法property()[sonar.jacoco.reportPaths,“ ProjectATest1 / gradleBuild / jacoco / Tests.exec”,“ ProjectATest2 / gradleBuild / jacoco / Tests.exec”,“ ProjectATest3 / gradleBuild / jacoco / Tests.exec“]
这意味着方法property
不允许传递4个参数。您必须在一个字符串(用逗号分隔的列表)中定义路径:
sonarqube{
properties {
property "sonar.jacoco.reportPaths", "ProjectATest1/gradleBuild/jacoco/Tests.exec,ProjectATest2/gradleBuild/jacoco/Tests.exec,ProjectATest3/gradleBuild/jacoco/Tests.exec"
}
}