Package org.gradle.api.plugins.quality
Class PmdExtension
java.lang.Object
org.gradle.api.plugins.quality.CodeQualityExtension
org.gradle.api.plugins.quality.PmdExtension
Configuration options for the PMD plugin.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionWhether or not to write PMD results toSystem.out.Controls whether to use incremental analysis or not.The maximum number of failures to allow before stopping the build.@Nullable TextResourceThe custom rule set to be used (if any).abstract ConfigurableFileCollectionThe custom rule set files to be used.abstract ListProperty<String> The built-in rule sets to be used.(package private) ListProperty<String> The rule priority threshold; violations for rules with a lower priority will not be reported.Deprecated.This property has no effect for PMD 5.0 and later, which infer the language version from the rule sets.The number of threads used by PMD.voidruleSetFiles(@Nullable Object... ruleSetFiles) Convenience method for adding rule set files.voidConvenience method for adding rule sets.voidsetConsoleOutput(boolean consoleOutput) Whether or not to write PMD results toSystem.out.voidsetRuleSetConfig(@Nullable TextResource ruleSetConfig) The custom rule set to be used (if any).voidsetRuleSetFiles(FileCollection ruleSetFiles) The custom rule set files to be used.voidsetRuleSets(List<String> ruleSets) The built-in rule sets to be used.voidsetTargetJdk(Object value) Deprecated.This property has no effect for PMD 5.0 and later, which infer the language version from the rule sets.voidsetTargetJdk(TargetJdk targetJdk) Deprecated.This property has no effect for PMD 5.0 and later, which infer the language version from the rule sets.Methods inherited from class org.gradle.api.plugins.quality.CodeQualityExtension
getIgnoreFailures, getIsIgnoreFailures, getReportsDir, getSourceSets, getToolVersion, setIgnoreFailures, setReportsDir, setSourceSets, setToolVersion
-
Constructor Details
-
PmdExtension
-
-
Method Details
-
getRuleSetsProperty
ListProperty<String> getRuleSetsProperty() -
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", unlessgetRuleSetConfig()returns a non-null value or the return value ofgetRuleSetFiles()is non-empty, in which case the conventional value is an empty list.ruleSets = ["category/java/errorprone.xml", "category/java/bestpractices.xml"] -
setRuleSets
The built-in rule sets to be used. See the official list of built-in rule sets.ruleSets = ["category/java/errorprone.xml", "category/java/bestpractices.xml"] -
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
Deprecated.This property has no effect for PMD 5.0 and later, which infer the language version from the rule sets. Scheduled to be removed in Gradle 10.The target jdk to use with pmd, 1.3, 1.4, 1.5, 1.6, 1.7 or jsp -
setTargetJdk
Deprecated.This property has no effect for PMD 5.0 and later, which infer the language version from the rule sets. Scheduled to be removed in Gradle 10.Sets the target jdk used with pmd.- Parameters:
targetJdk- The target jdk- Since:
- 4.0
-
setTargetJdk
Deprecated.This property has no effect for PMD 5.0 and later, which infer the language version from the rule sets. Scheduled to be removed in Gradle 10.Sets the target jdk used with pmd.- Parameters:
value- The value for the target jdk as defined byTargetJdk.toVersion(Object)
-
getMaxFailures
The maximum number of failures to allow before stopping the build. IfignoreFailuresis set, this is ignored and no limit is enforced.- Since:
- 6.4
-
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
The custom rule set to be used (if any). ReplacesruleSetFiles, 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
The custom rule set to be used (if any). ReplacesruleSetFiles, 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
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") -
setRuleSetFiles
The custom rule set files to be used. See the official documentation for how to author a rule set file. This adds to the default rule sets defined bygetRuleSets().ruleSetFiles = files("config/pmd/myRuleSets.xml") -
ruleSetFiles
Convenience method for adding rule set files.ruleSetFiles "config/pmd/myRuleSet.xml"- Parameters:
ruleSetFiles- the rule set files to be added
-
getConsoleOutput
Whether or not to write PMD results toSystem.out. -
setConsoleOutput
public void setConsoleOutput(boolean consoleOutput) Whether or not to write PMD results toSystem.out. -
getIsConsoleOutput
-
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
The number of threads used by PMD.- Since:
- 7.5
-