不推荐使用属性“sonar.jacoco.reportPath".请改用“sonar.jacoco.reportPaths"

2022-01-17 00:00:00 sonarqube gradle java jacoco

不推荐使用属性sonar.jacoco.reportPath".请用'sonar.jacoco.reportPaths' 代替.

Property 'sonar.jacoco.reportPath' is deprecated. Please use 'sonar.jacoco.reportPaths' instead.

我在通过 Gradle 运行 SonarQube 时不断收到此消息,并且在整个多模块项目中甚至一次都没有出现reportPath"这个短语.我什至将 sonarqube 属性放在 allprojects 下,以覆盖可能存在的任何默认值.有关如何摆脱此错误的任何提示?

I keep getting this message when running SonarQube through Gradle and the phrase "reportPath" does not even appear even once in the entire multi-module project. I even put the sonarqube property under allprojects to override any defaults that may be there. Any tips on how I can get rid of this error?

我正在使用:

allprojects {
    sonarqube {
        properties {
            property "sonar.jacoco.reportPaths", "${project.buildDir}/jacoco/test.exec"
        }
    }
}

编辑 1:

Gradle 包装器 3.1

Gradle wrapper 3.1

我在 build.gradle 的根目录中使用它

Am using this in the root of build.gradle

plugins {
    id "jacoco"
    id "org.sonarqube" version "2.5"
}

并尝试了您的建议

allprojects {
    sonarqube {
        properties {
            property "sonar.jacoco.reportPath", ""
            property "sonar.jacoco.reportPaths", "${project.buildDir}/jacoco/test.exec"
        }
    }
}

没有骰子,你怎么看?

推荐答案

问题是,你使用的是哪个版本的 sonarQube gradle 插件:https://docs.sonarqube.org/display/SCAN/分析+with+SonarQube+Scanner+for+Gradle

The question is, which version of the sonarQube gradle plugin you are using: https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Gradle

sonarqube gradle 插件默认设置一些值,例如.如果您使用 JaCoCo,它可能会自动添加该字段,除了 groovy 字段.

The sonarqube gradle plugin sets some values per default, eg. if you use JaCoCo, which is probably the case, it automatically adds that field, besides the groovy one too.

所以一般来说,你需要等待sonarqube gradle插件的更新,它摆脱了这个,并且正在使用其他配置值.

So generally speaking, you need to wait for an update of the sonarqube gradle plugin, which gets rid of this, and is using the other config value.

也许您也可以尝试覆盖该设置,方法是将其设置为空,例如 sonar.jacoco.reportPath=

Maybe you can also try to override the setting, by setting it to empty like sonar.jacoco.reportPath=

相关文章