Package org.gradle.api.plugins.quality

# Class PmdExtension

java.lang.Object
org.gradle.api.plugins.quality.CodeQualityExtension
org.gradle.api.plugins.quality.PmdExtension

public abstract class PmdExtension extends CodeQualityExtension
Configuration options for the PMD plugin.

See Also:
  - `PmdPlugin`

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `(package private) static class`
  `PmdExtension.TargetJdkAdapter`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PmdExtension(Project project)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract Property<Boolean>`
  `getConsoleOutput()`
  Whether or not to write PMD results to `System.out`.
  `abstract Property<Boolean>`
  `getIncrementalAnalysis()`
  Controls whether to use incremental analysis or not.
  `Property<Boolean>`
  `getIsConsoleOutput()`
  `abstract Property<Integer>`
  `getMaxFailures()`
  The maximum number of failures to allow before stopping the build.
  `@Nullable TextResource`
  `getRuleSetConfig()`
  The custom rule set to be used (if any).
  `abstract ConfigurableFileCollection`
  `getRuleSetFiles()`
  The custom rule set files to be used.
  `abstract ListProperty<String>`
  `getRuleSets()`
  The built-in rule sets to be used.
  `(package private) ListProperty<String>`
  `getRuleSetsProperty()`
  `abstract Property<Integer>`
  `getRulesMinimumPriority()`
  The rule priority threshold; violations for rules with a lower priority will not be reported.
  `abstract Property<TargetJdk>`
  `getTargetJdk()`
  The target jdk to use with pmd, 1.3, 1.4, 1.5, 1.6, 1.7 or jsp
  `abstract Property<Integer>`
  `getThreads()`
  The number of threads used by PMD.
  `void`
  `ruleSetFiles(@Nullable Object... ruleSetFiles)`
  Convenience method for adding rule set files.
  `void`
  `ruleSets(String... ruleSets)`
  Convenience method for adding rule sets.
  `void`
  `setRuleSetConfig(@Nullable TextResource ruleSetConfig)`
  The custom rule set to be used (if any).

  ### Methods inherited from class org.gradle.api.plugins.quality.CodeQualityExtension

  `getIgnoreFailures, getIsIgnoreFailures, getReportsDir, getSourceSets, getToolVersion`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### PmdExtension

    public PmdExtension(Project project)

- ## Method Details

  - ### getRuleSetsProperty

    ListProperty<String> getRuleSetsProperty()

  - ### getRuleSets

    public abstract ListProperty<String> getRuleSets()
    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 `getRuleSetConfig()` returns a non-null value or the return value of `getRuleSetFiles()` is non-empty, in which case the conventional value is an empty list.

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

  - ### ruleSets

    public void ruleSets(String... ruleSets)
    Convenience method for adding rule sets.

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

    Parameters:
      `ruleSets` - the rule sets to be added

  - ### getTargetJdk

    public abstract Property<TargetJdk> getTargetJdk()
    The target jdk to use with pmd, 1.3, 1.4, 1.5, 1.6, 1.7 or jsp

  - ### getMaxFailures

    public abstract Property<Integer> getMaxFailures()
    The maximum number of failures to allow before stopping the build. If `ignoreFailures` is set, this is ignored and no limit is enforced.
    Since:
      6.4

  - ### getRulesMinimumPriority

    public abstract Property<Integer> getRulesMinimumPriority()
    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

    Since:
      6.8

  - ### getRuleSetConfig

    public @Nullable TextResource getRuleSetConfig()
    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")

    Since:
      2.2

  - ### setRuleSetConfig

    public void setRuleSetConfig(@Nullable 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")

    Since:
      2.2

  - ### getRuleSetFiles

    public abstract ConfigurableFileCollection getRuleSetFiles()
    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")

  - ### ruleSetFiles

    public void ruleSetFiles(@Nullable Object... ruleSetFiles)
    Convenience method for adding rule set files.

             ruleSetFiles "config/pmd/myRuleSet.xml"

    Parameters:
      `ruleSetFiles` - the rule set files to be added

  - ### getConsoleOutput

    public abstract Property<Boolean> getConsoleOutput()
    Whether or not to write PMD results to `System.out`.

  - ### getIsConsoleOutput

    public Property<Boolean> getIsConsoleOutput()

  - ### getIncrementalAnalysis

    public abstract Property<Boolean> getIncrementalAnalysis()
    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.
    Since:
      5.6

  - ### getThreads

    public abstract Property<Integer> getThreads()
    The number of threads used by PMD.
    Since:
      7.5