Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup Findbugs for a Java 8 project with gradle?

I have a Java 8 project build using gradle 1.12 which works perfect. Now I want to use FindBugs and as I use Java 8 I have to use FindBugs 3. But the build hangs in findbugsMain:

:my-module:compileJava UP-TO-DATE
:my-module:processResources UP-TO-DATE
:my-module:classes UP-TO-DATE
> Building 6% > :my-module:findbugsMain

The resulting build.gradle contains the following:

apply plugin: 'java'
apply plugin: 'findbugs'

findbugs.toolVersion = '3.0.0'

dependencies {
  compile 'com.google.code.findbugs:annotations:3.0.0'
  …
}

Any Idea why the build is getting hanged? What should I do?

like image 696
Arne Burmeister Avatar asked Sep 01 '14 07:09

Arne Burmeister


People also ask

How do you run FindBugs?

The preferred method of running FindBugs is to directly execute $FINDBUGS_HOME /lib/findbugs. jar using the -jar command line switch of the JVM (java) executable. (Versions of FindBugs prior to 1.3. 5 required a wrapper script to invoke FindBugs.)

Is FindBugs deprecated?

FindBugs support is deprecated, because project is abandoned. Use SpotBugs successor project instead. By default, quality plugin will activate SpotBugs and not findbugs.

How do I run checkstyle in gradle?

To use checkstyle in Gradle you have add the plug-in to your build. gradle and provide a config\checkstyle\checkstyle. xml checkstyle configuration file. A detailed example is given in the checkstyle with Gradle exercise.

What are Gradle plugins?

A plugin is simply any class that implements the Plugin interface. Gradle provides the core plugins (e.g. JavaPlugin ) as part of its distribution which means they are automatically resolved. However, non-core binary plugins need to be resolved before they can be applied.


1 Answers

Ok, after all it seems that findbugs 3 simply does not work with gradle 1.x!

After switching to gradle 2.1 all works fine.

Thanks to Peter Niederwieser!

like image 133
Arne Burmeister Avatar answered Oct 24 '22 00:10

Arne Burmeister