Gradle unable to infer findbugs version from classpath

So we were getting an issue with our build with an older version of Gradle (1.6) during the running of our test scripts (org.gradle.messaging.remote.internal.MessageIOException). Google that error led to the recommendation that we upgrade our version of Gradle.

I downloaded the newest version (2.3) and tried again, and got the error that Gradle was unable to infer the version of findbugs from the classpath - findbugs.jar. To remedy this, I added a the following line to the build.gradle: findbugs { toolVersion = “2.0.1”} AND I also had to rename the findbugs.jar to findbugs-2.0.1.jar.

The question is, why should I need to rename my findbugs.jar file? Shouldn’t gradle be “smart” enough to find the default named findbugs.jar file downloaded from the release from sourceforge (confirmed to be the same name with the latest FindBugs release as well)? Are there any other alternatives?

so you say you downloaded the findbugs manually? I think you have two options here:

  1. declare the toolVersion (e.g. toolVersion = “2.0.1”) and add a repository that can resolve this findbugs version 2. add a file based dependency to the ‘findbugsPlugins’ configuration:
dependencies {
        findbugsPlugins files("path/to/your/manually/downloaded.jar")

So we already had a repository defined that pointed to the /lib directory of our findbugs install, but the gradle code searches there for a jar file that matches the pattern “findbugs-*.jar” (as shown in in the getFindBugsVersion() method). Just declaring the toolVersion is not sufficient to avoid going into that method as it is called immediately from the validateClasspath() method). I tried to get the second option to work, but I may be doing it incorrectly. I added the findbugsPlugins files line to our dependencies, removed the findbugs directory in the repositories area, and now I get an error that it can’t find (or 2.0.1 if I leave the toolVersion in). So it looks like it is looking directly in the directories defined in as repositories and ignores the line I put into the dependencies block altogether. Am I doing something wrong here? Does that dependencies block that you specified above NOT go in my build.gradle but instead in a different file? Thanks for the help.

In case it’s not clear, the only combination that has worked so far with the latest version of Gradle is adding in the toolVersion = “2.0.1”, having the lib directory of FindBugs referenced in the repositories section of the build.gradle, and also renaming the findbugs.jar file to findbugs-2.0.1.jar.