Comparable<Task>
, org.gradle.api.internal.DynamicObjectAware
, org.gradle.api.internal.IConventionAware
, org.gradle.api.internal.TaskInternal
, ExtensionAware
, Reporting<PmdReports>
, Task
, PatternFilterable
, VerificationTask
, Configurable<Task>
@CacheableTask public class Pmd extends SourceTask implements VerificationTask, Reporting<PmdReports>
PmdPlugin
,
PmdExtension
Task.Namer
TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
Constructor | Description |
---|---|
Pmd() |
Modifier and Type | Method | Description |
---|---|---|
org.gradle.api.internal.project.IsolatedAntBuilder |
getAntBuilder() |
|
FileCollection |
getClasspath() |
Compile class path for the classes to be analyzed.
|
boolean |
getIgnoreFailures() |
Whether or not to allow the build to continue if there are warnings.
|
Property<Boolean> |
getIncrementalAnalysis() |
Controls whether to use incremental analysis or not.
|
File |
getIncrementalCacheFile() |
Path to the incremental cache file, if incremental analysis is used.
|
Property<Integer> |
getMaxFailures() |
The maximum number of failures to allow before stopping the build.
|
protected ObjectFactory |
getObjectFactory() |
|
FileCollection |
getPmdClasspath() |
The class path containing the PMD library to be used.
|
PmdReports |
getReports() |
The reports to be generated by this task.
|
TextResource |
getRuleSetConfig() |
The custom rule set to be used (if any).
|
FileCollection |
getRuleSetFiles() |
The custom rule set files to be used.
|
List<String> |
getRuleSets() |
The built-in rule sets to be used.
|
Property<Integer> |
getRulesMinimumPriority() |
Specifies the rule priority threshold.
|
FileTree |
getSource() |
Returns the source for this task, after the include and exclude patterns have been applied.
|
TargetJdk |
getTargetJdk() |
The target JDK to use with PMD.
|
Property<Integer> |
getThreads() |
Specifies the number of threads used by PMD.
|
boolean |
isConsoleOutput() |
Whether or not to write PMD results to
System.out . |
PmdReports |
reports(Closure closure) |
Configures the reports to be generated by this task.
|
PmdReports |
reports(Action<? super PmdReports> configureAction) |
Configures the reports to be generated by this task.
|
void |
run() |
|
void |
setClasspath(FileCollection classpath) |
Compile class path for the classes to be analyzed.
|
void |
setConsoleOutput(boolean consoleOutput) |
Whether or not to write PMD results to
System.out . |
void |
setIgnoreFailures(boolean ignoreFailures) |
Whether or not to allow the build to continue if there are warnings.
|
void |
setPmdClasspath(FileCollection pmdClasspath) |
The class path containing the PMD library to be used.
|
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(List<String> ruleSets) |
The built-in rule sets to be used.
|
void |
setTargetJdk(TargetJdk targetJdk) |
The target JDK to use with PMD.
|
boolean |
stdOutIsAttachedToTerminal() |
|
static void |
validate(int value) |
Validates the value is a valid PMD rules minimum priority (1-5)
|
exclude, exclude, exclude, exclude, getExcludes, getIncludes, getPatternSet, getPatternSetFactory, include, include, include, include, setExcludes, setIncludes, setSource, setSource, source
conventionMapping, conventionMapping, getConventionMapping
compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService
appendParallelSafeAction, doNotTrackState, getAsDynamicObject, getConvention, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, setImpliesSubProjects
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
doNotTrackState, getConvention, notCompatibleWithConfigurationCache
@Inject protected ObjectFactory getObjectFactory()
@Inject public org.gradle.api.internal.project.IsolatedAntBuilder getAntBuilder()
public void run()
public boolean stdOutIsAttachedToTerminal()
public PmdReports reports(@DelegatesTo(value=PmdReports.class,strategy=1) Closure closure)
reports
in interface Reporting<PmdReports>
closure
- The configurationpublic PmdReports reports(Action<? super PmdReports> configureAction)
reports
in interface Reporting<PmdReports>
configureAction
- The configurationpublic static void validate(int value)
value
- rules minimum priority threshold@PathSensitive(RELATIVE) public FileTree getSource()
The PathSensitivity
for the sources is configured to be PathSensitivity.ABSOLUTE
.
If your sources are less strict, please change it accordingly by overriding this method in your subclass.
getSource
in class SourceTask
@Classpath public FileCollection getPmdClasspath()
public void setPmdClasspath(FileCollection pmdClasspath)
@Input public List<String> getRuleSets()
ruleSets = ["basic", "braces"]
public void setRuleSets(List<String> ruleSets)
ruleSets = ["basic", "braces"]
public void setTargetJdk(TargetJdk targetJdk)
@Nullable @Optional public TextResource getRuleSetConfig()
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(resources.file("config/pmd/myRuleSets.xml"))
public void setRuleSetConfig(@Nullable TextResource ruleSetConfig)
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(resources.file("config/pmd/myRuleSets.xml"))
@InputFiles @PathSensitive(NONE) public FileCollection getRuleSetFiles()
ruleSets
.
ruleSetFiles = files("config/pmd/myRuleSet.xml")
public void setRuleSetFiles(FileCollection ruleSetFiles)
getRuleSets()
.
ruleSetFiles = files("config/pmd/myRuleSets.xml")
public final PmdReports getReports()
getReports
in interface Reporting<PmdReports>
public boolean getIgnoreFailures()
ignoreFailures = true
getIgnoreFailures
in interface VerificationTask
public void setIgnoreFailures(boolean ignoreFailures)
ignoreFailures = true
setIgnoreFailures
in interface VerificationTask
ignoreFailures
- false to break the build on failure, true to ignore the failures. The default is false.@Input public Property<Integer> getMaxFailures()
ignoreFailuresis set, this is ignored and the build will continue (infinite failures allowed).
@Input public Property<Integer> getRulesMinimumPriority()
PmdExtension.getRulesMinimumPriority()
@Input public boolean isConsoleOutput()
System.out
.public void setConsoleOutput(boolean consoleOutput)
System.out
.@Nullable @Optional @Classpath public FileCollection getClasspath()
public void setClasspath(@Nullable FileCollection classpath)
@Internal public Property<Boolean> getIncrementalAnalysis()
@LocalState public File getIncrementalCacheFile()
@Input @Incubating public Property<Integer> getThreads()
PmdExtension.getThreads()