Gradle id为';com.github.spotbug';找不到

Gradle id为';com.github.spotbug';找不到,gradle,spotbugs,Gradle,Spotbugs,我第一次为Gradle项目进行配置 buildscript { repositories { maven { url 'https://plugins.gradle.org/m2/' } } dependencies { classpath 'gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:1.6.6' } } apply plugin: 'com.github.spotbug

我第一次为Gradle项目进行配置

buildscript {
  repositories {
    maven {
      url 'https://plugins.gradle.org/m2/'
    }
  }
  dependencies {
    classpath 'gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:1.6.6'
  }
}

apply plugin: 'com.github.spotbugs'
运行
gradle check
时,我发现id为'com.github.spotbug'的插件出现错误。我做错了什么


Gradle 5.0版。

您也看过这个吗?您的构建脚本适用于我的Gradle 5.0项目(使用Gradle包装器)。我对构建脚本所做的唯一更改是在最后添加
apply plugin:'java'
,以实际获得要测试的
检查任务。您的gradle用户主页中是否有
缓存/modules-2/files-2.1/gradle.plugin.com.github.spotbug/spotbug-gradle-plugin/1.6.6/
(通常
~/.gradle/
)?否则,您与Gradle插件库的网络连接可能会出现问题。为什么不使用
plugins{id“com.github.spotbug”version“1.6.6”}
DSL?我遇到了几乎相同的问题:您使用的配置适合我-但我得到了相同的错误(找不到id为“com.github.spotbug”的插件)如果我将它从build.gradle移动到另一个文件(spotbug.gradle)中,并在build.gradle中应用
apply from:'spotbug.gradle'
我也遇到了同样的问题,请查看我的解决方案