Resolve findBugs issue in gradle
Asked Answered
D

2

23

Overview:

I am trying to upgrade Java and Gradle version in my project as follows:

  • java from 8 to 11
  • Gradle from 5 to 6

My project runs with no issues on the old versions but when runs on Java 11 and Gradle 6 it complains about fireBugs plugin and raises the following exception:

 > Plugin with id 'findbugs' not found.

Snippet of gradle file:

buildscript {
    ext {
        SampleProjectVersion = '1.3.4'
    }
    repositories {
        mavenLocal()
        maven {
            url1
        }
    }
    dependencies {
        classpath(sample lib 1)
        classpath(sample lib 2)
    }

apply plugin: 'findbugs'

...

I would appreciate if you could share your thoughts with me as I couldn't find any proper solution for that.

Donalt answered 22/11, 2019 at 0:55 Comment(1)
Not aware if any such plugin with an exact id of findbugs, see the search here. If it's a custom plugin, make sure the marker is published as well.Hedve
B
28

From the Gradle web site (Upgrading your build from Gradle 5.x to 6.0):

The FindBugs plugin has been removed

The deprecated FindBugs plugin has been removed. As an alternative, you can use the SpotBugs plugin from the Gradle Plugin Portal.

https://docs.gradle.org/current/userguide/upgrading_version_5.html

Bogosian answered 29/11, 2019 at 10:8 Comment(1)
Till what gradle version is findbugs supported?Gath
R
2

You can use the SpotBugs plugin. Try my snippet of gradle file

buildscript {
ext {
    SampleProjectVersion = '1.3.4'
}
repositories {
    mavenLocal()
    maven {
        url1
    }
}
dependencies {
    classpath(sample lib 1)
    classpath(sample lib 2)
    classpath "gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:2.0.0"
}

apply plugin: "com.github.spotbugs"

tasks.withType(com.github.spotbugs.SpotBugsTask) {
    spotbugsMain.enabled = true
    spotbugsTest.enabled = true
    reports {
        xml.enabled = false
        html.enabled = true
    }
}
...
Raymer answered 21/12, 2020 at 16:6 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.