我的 gradle 项目无法构建。它失败,找不到 id 'sonar-runner' 的插件。
这是我的 build.gradle
subprojects {
apply plugin: 'sonar-runner'
}
我已经刷新了我的 Gradle 项目。然后我删除了 ~/.gradle/caches 文件夹,但没有用。然后我删除了整个 ~/.gradle 文件夹,仍然是同样的错误。
请问有什么想法吗?
有趣的是 gradle build 没有运行并给了我这个异常,但是 bash gradle build 运行良好,有人可以澄清两者之间的区别吗?谢谢。我的设置是在 Mac OSX 10.11.6 上。
最佳答案
来自https://docs.sonarqube.org/display/SONARQUBE51/Analyzing+with+Gradle :
Users of Gradle Sonar or Sonar Runner Plugins ? The existing Gradle Sonar Runner and Gradle Sonar plugins, which are part of the Gradle distribution, should no longer be used (See this official note from the Gradleware team). The use of the Gradle SonarQube plugin is recommended instead.
您必须按照https://plugins.gradle.org/plugin/org.sonarqube中的描述使用它。
构建用于所有 Gradle 版本的脚本片段:
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.2.1"
}
}
apply plugin: "org.sonarqube"
为 Gradle 2.1 中引入的新的孵化插件机制构建脚本片段:
plugins {
id "org.sonarqube" version "2.2.1"
}
讨论这个问题的问题: https://discuss.gradle.org/t/plugin-with-id-org-sonarqube-not-found/11588/10
关于gradle构建失败找不到声纳插件 "sonar-runner",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41901003/