Chapter 31. The FindBugs Plugin

The FindBugs plugin performs quality checks on your project's Java source files using FindBugs and generates reports from these checks.

31.1. Usage

To use the FindBugs plugin, include in your build script:

Example 31.1. Using the FindBugs plugin

build.gradle

apply plugin: 'findbugs'

The plugin adds a number of tasks to the project that perform the quality checks. You can execute the checks by running gradle check.

31.2. Tasks

The FindBugs plugin adds the following tasks to the project:

Table 31.1. FindBugs plugin - tasks

Task name Depends on Type Description
findbugsMain classes FindBugs Runs FindBugs against the production Java source files.
findbugsTest testClasses FindBugs Runs FindBugs against the test Java source files.
findbugsSourceSet sourceSetClasses FindBugs Runs FindBugs against the given source set's Java source files.

The FindBugs plugin adds the following dependencies to tasks defined by the Java plugin.

Table 31.2. FindBugs plugin - additional task dependencies

Task nameDepends on
check All FindBugs tasks, including findbugsMain and findbugsTest.

31.3. Dependency management

The FindBugs plugin adds the following dependency configurations:

Table 31.3. FindBugs plugin - dependency configurations

Name Meaning
findbugs The FindBugs libraries to use

31.4. Configuration

See FindBugsExtension.