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
-
-
Constructor Summary
Constructors Constructor Description PmdExtension(Project project)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Property<java.lang.Boolean>
getIncrementalAnalysis()
Controls whether to use incremental analysis or not.Property<java.lang.Integer>
getMaxFailures()
The maximum number of failures to allow before stopping the build.TextResource
getRuleSetConfig()
The custom rule set to be used (if any).FileCollection
getRuleSetFiles()
The custom rule set files to be used.java.util.List<java.lang.String>
getRuleSets()
The built-in rule sets to be used.Property<java.lang.Integer>
getRulesMinimumPriority()
The rule priority threshold; violations for rules with a lower priority will not be reported.TargetJdk
getTargetJdk()
The target jdk to use with pmd, 1.3, 1.4, 1.5, 1.6, 1.7 or jspProperty<java.lang.Integer>
getThreads()
The number of threads used by PMD.boolean
isConsoleOutput()
Whether or not to write PMD results toSystem.out
.void
ruleSetFiles(java.lang.Object... ruleSetFiles)
Convenience method for adding rule set files.void
ruleSets(java.lang.String... ruleSets)
Convenience method for adding rule sets.void
setConsoleOutput(boolean consoleOutput)
Whether or not to write PMD results toSystem.out
.void
setRuleSetConfig(TextResource ruleSetConfig)
The custom rule set to be used (if any).void
setRuleSetFiles(FileCollection ruleSetFiles)
The custom rule set files to be used.void
setRuleSets(java.util.List<java.lang.String> ruleSets)
The built-in rule sets to be used.void
setTargetJdk(java.lang.Object value)
Sets the target jdk used with pmd.void
setTargetJdk(TargetJdk targetJdk)
Sets the target jdk used with pmd.-
Methods inherited from class org.gradle.api.plugins.quality.CodeQualityExtension
getReportsDir, getSourceSets, getToolVersion, isIgnoreFailures, setIgnoreFailures, setReportsDir, setSourceSets, setToolVersion
-
-
-
-
Constructor Detail
-
PmdExtension
public PmdExtension(Project project)
-
-
Method Detail
-
getRuleSets
public java.util.List<java.lang.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", unlessgetRuleSetConfig()
returns. a non-null value or the return value ofgetRuleSetFiles()
is non-empty, in which case the conventional value is an empty listruleSets = ["category/java/errorprone.xml", "category/java/bestpractices.xml"]
-
setRuleSets
public void setRuleSets(java.util.List<java.lang.String> ruleSets)
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
public void ruleSets(java.lang.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 TargetJdk getTargetJdk()
The target jdk to use with pmd, 1.3, 1.4, 1.5, 1.6, 1.7 or jsp
-
setTargetJdk
public void setTargetJdk(TargetJdk targetJdk)
Sets the target jdk used with pmd.- Parameters:
targetJdk
- The target jdk- Since:
- 4.0
-
getMaxFailures
public Property<java.lang.Integer> getMaxFailures()
The maximum number of failures to allow before stopping the build. IfignoreFailures
is set, this is ignored and no limit is enforced.- Since:
- 6.4
-
setTargetJdk
public void setTargetJdk(java.lang.Object value)
Sets the target jdk used with pmd.- Parameters:
value
- The value for the target jdk as defined byTargetJdk.toVersion(Object)
-
getRulesMinimumPriority
public Property<java.lang.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
@Nullable public TextResource 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
public void setRuleSetConfig(@Nullable TextResource ruleSetConfig)
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
public FileCollection 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
public void setRuleSetFiles(FileCollection ruleSetFiles)
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
public void ruleSetFiles(java.lang.Object... ruleSetFiles)
Convenience method for adding rule set files.ruleSetFiles "config/pmd/myRuleSet.xml"
- Parameters:
ruleSetFiles
- the rule set files to be added
-
isConsoleOutput
public boolean isConsoleOutput()
Whether or not to write PMD results toSystem.out
.
-
setConsoleOutput
public void setConsoleOutput(boolean consoleOutput)
Whether or not to write PMD results toSystem.out
.
-
getIncrementalAnalysis
public Property<java.lang.Boolean> getIncrementalAnalysis()
Controls whether to use incremental analysis or not. This is only supported for PMD 6.0.0 or better. See for more details.- Since:
- 5.6
-
getThreads
public Property<java.lang.Integer> getThreads()
The number of threads used by PMD.- Since:
- 7.5
-
-