6

I'm configuring SpotBugs plugin for a Gradle project for the first time.

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'

When running gradle check I'm getting error Plugin with id 'com.github.spotbugs' not found. What am I doing wrong?

Gradle version 5.0.

naXa stands with Ukraine
  • 35,493
  • 19
  • 190
  • 259
  • Have you also had a look at this? https://spotbugs.readthedocs.io/en/latest/gradle.html – shadowsheep Dec 15 '18 at 13:39
  • Your build script works for me with an otherwise empty Gradle 5.0 project (using a Gradle wrapper). The only change I’ve made to your build script is to add `apply plugin: 'java'` at the end to actually get the `check` task to test with. Do you have `caches/modules-2/files-2.1/gradle.plugin.com.github.spotbugs/spotbugs-gradle-plugin/1.6.6/` in you Gradle user home (typically `~/.gradle/`)? Otherwise there might have been an issue with your network connection to the Gradle plugins repository. – Chriki Dec 16 '18 at 16:04
  • Why not use `plugins { id "com.github.spotbugs" version "1.6.6" }` DSL? – madhead Dec 16 '18 at 23:44
  • 1
    I'm having almost the same problem: The configuration you're using works for me - but I get the same error (Plugin with id 'com.github.spotbugs' not found) if I move it from build.gradle to another file (spotbugs.gradle) an apply in build.gradle with `apply from: 'spotbugs.gradle'` – Nausika Aug 16 '19 at 05:53
  • 1
    I had the same problem, have a look at my solution https://github.com/spotbugs/spotbugs/issues/1027#issuecomment-548588144 – tsarenkotxt Oct 31 '19 at 22:08

0 Answers0