# Chapter 62. The PMD Plugin

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

## 62.1. Usage

To use the PMD plugin, include the following in your build script:

Example 62.1. Using the PMD plugin

`build.gradle`

    apply plugin: 'pmd'

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

Note that Findbugs will run with the same Java version used to run Gradle.

## 62.2. Tasks

The PMD plugin adds the following tasks to the project:

Table 62.1. PMD plugin - tasks

Task name | Depends on | Type | Description
`pmdMain` | - | `Pmd` | Runs PMD against the production Java source files.
`pmdTest` | - | `Pmd` | Runs PMD against the test Java source files.
`pmd`SourceSet`` | - | `Pmd` | Runs PMD against the given source set's Java source files.

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

Table 62.2. PMD plugin - additional task dependencies

Task name | Depends on
`check` | All PMD tasks, including `pmdMain` and `pmdTest`.

## 62.3. Dependency management

The PMD plugin adds the following dependency configurations:

Table 62.3. PMD plugin - dependency configurations

Name | Meaning
`pmd` | The PMD libraries to use

## 62.4. Configuration

See the `PmdExtension` class in the API documentation.