# PmdExtension

API Documentation: | `PmdExtension`

Configuration options for the PMD plugin.

### Properties

Property | Description
`consoleOutput` | Whether or not to write PMD results to `System.out`.
`ignoreFailures` | Whether to allow the build to continue if there are warnings. Example: ignoreFailures = true
`incrementalAnalysis` | Controls whether to use incremental analysis or not. This is only supported for PMD 6.0.0 or better. See official documentation for more details.
`maxFailures` | The maximum number of failures to allow before stopping the build. If `ignoreFailures` is set, this is ignored and no limit is enforced.
`reportsDir` | Replaced The directory where reports will be generated.
`ruleSetConfig` | The custom rule set to be used (if any). Replaces `ruleSetFiles`, except that it does not currently support multiple rule sets. See the official documentation for how to author a rule set.
`ruleSetFiles` | The custom rule set files to be used. See the official documentation for how to author a rule set file.
`ruleSets` | The built-in rule sets to be used. See the official list of built-in rule sets. If not configured explicitly, the returned conventional value is "category/java/errorprone.xml", unless `PmdExtension.getRuleSetConfig()` returns a non-null value or the return value of `PmdExtension.getRuleSetFiles()` is non-empty, in which case the conventional value is an empty list.
`rulesMinimumPriority` | The rule priority threshold; violations for rules with a lower priority will not be reported. Default value is 5, which means that all violations will be reported. This is equivalent to PMD's Ant task minimumPriority property. See the official documentation for the list of priorities.
`sourceSets` | The source sets to be analyzed as part of the `check` and `build` tasks.
`targetJdk` | Deprecated The target jdk to use with pmd, 1.3, 1.4, 1.5, 1.6, 1.7 or jsp
`threads` | The number of threads used by PMD.
`toolVersion` | The version of the code quality tool to be used.

### Methods

Method | Description
`ruleSetFiles(ruleSetFiles)` | Convenience method for adding rule set files.
`ruleSets(ruleSets)` | Convenience method for adding rule sets.

### Script blocks

No script blocks

### Property details

#### ``Property`<`Boolean`>` `consoleOutput`

Whether or not to write PMD results to `System.out`.

Default:
  `false`

#### ``Property`<`Boolean`>` `ignoreFailures`

Whether to allow the build to continue if there are warnings. Example: ignoreFailures = true

Default:
  `false`

#### ``Property`<`Boolean`>` `incrementalAnalysis`

Controls whether to use incremental analysis or not. This is only supported for PMD 6.0.0 or better. See official documentation for more details.

Default:
  `false`

#### ``Property`<`Integer`>` `maxFailures`

The maximum number of failures to allow before stopping the build. If `ignoreFailures` is set, this is ignored and no limit is enforced.

Default:
  `0`

#### `File` `reportsDir`

Note: This property has been replaced by reportsDirectory.

The directory where reports will be generated.

Default:
  ``${project.reporting.baseDirectory}`/pmd`

#### `TextResource` `ruleSetConfig`

The custom rule set to be used (if any). Replaces `ruleSetFiles`, except that it does not currently support multiple rule sets. See the official documentation for how to author a rule set.

        ruleSetConfig = resources.text.fromFile("config/pmd/myRuleSet.xml")

Default:
  `null`

#### `ConfigurableFileCollection` `ruleSetFiles`

The custom rule set files to be used. See the official documentation for how to author a rule set file.

        ruleSetFiles = files("config/pmd/myRuleSet.xml")

Default:
  `[]`

#### ``ListProperty`<`String`>` `ruleSets`

The built-in rule sets to be used. See the official list of built-in rule sets. If not configured explicitly, the returned conventional value is "category/java/errorprone.xml", unless `PmdExtension.getRuleSetConfig()` returns a non-null value or the return value of `PmdExtension.getRuleSetFiles()` is non-empty, in which case the conventional value is an empty list.

        ruleSets = ["category/java/errorprone.xml", "category/java/bestpractices.xml"]

Default:
  `["category/java/errorprone.xml"]`

#### ``Property`<`Integer`>` `rulesMinimumPriority`

The rule priority threshold; violations for rules with a lower priority will not be reported. Default value is 5, which means that all violations will be reported. This is equivalent to PMD's Ant task minimumPriority property. See the official documentation for the list of priorities.

        rulesMinimumPriority = 3

Default:
  `5`

#### ``ListProperty`<`SourceSet`>` `sourceSets`

The source sets to be analyzed as part of the `check` and `build` tasks.

Default:
  `project.sourceSets`

#### `TargetJdk` `targetJdk`

Note: This property is deprecated and will be removed in the next major version of Gradle.

The target jdk to use with pmd, 1.3, 1.4, 1.5, 1.6, 1.7 or jsp

Default:
  `project.sourceCompatibility`

#### ``Property`<`Integer`>` `threads`

The number of threads used by PMD.

Default:
  `1`

#### ``Property`<`String`>` `toolVersion`

The version of the code quality tool to be used.

Default:
  `6.15.0`

### Method details

#### `void` `ruleSetFiles`(``Object`...` ruleSetFiles)

Convenience method for adding rule set files.

        ruleSetFiles "config/pmd/myRuleSet.xml"

#### `void` `ruleSets`(``String`...` ruleSets)

Convenience method for adding rule sets.

        ruleSets "category/java/errorprone.xml", "category/java/bestpractices.xml"