pmd:pmd

Note:This goal should be used as a Maven report.

Full name:

org.apache.maven.plugins:maven-pmd-plugin:3.12.0:pmd

Description:

Creates a PMD report.

Attributes:

  • Requires a Maven project to be executed.
  • Requires dependency resolution of artifacts in scope: test.
  • Since version: 2.0.

Required Parameters

Name Type Since Description
outputDirectory File 2.0 The output directory for the final HTML report. Note that this parameter is only evaluated if the goal is run directly from the command line or during the default lifecycle. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.
User property is: project.reporting.outputDirectory.
targetDirectory File 2.0 The output directory for the intermediate XML report.
User property is: project.build.directory.

Optional Parameters

Name Type Since Description
aggregate boolean 2.2 Whether to build an aggregated report at the root, or build individual reports.
Default value is: false.
User property is: aggregate.
analysisCache boolean 3.8 Enables the analysis cache, which speeds up PMD. This requires a cache file, that contains the results of the last PMD run. Thus the cache is only effective, if this file is not cleaned between runs.
Default value is: false.
User property is: pmd.analysisCache.
analysisCacheLocation String 3.8 The location of the analysis cache, if it is enabled. This file contains the results of the last PMD run and must not be cleaned between consecutive PMD runs. Otherwise the cache is not in use. If the file doesn't exist, PMD executes as if there is no cache enabled and all files are analyzed. Otherwise only changed files will be analyzed again.
Default value is: ${project.build.directory}/pmd/pmd.cache.
User property is: pmd.analysisCacheLocation.
benchmark boolean 3.1 Controls whether PMD will track benchmark information.
Default value is: false.
User property is: pmd.benchmark.
benchmarkOutputFilename String 3.1 Benchmark output filename.
Default value is: ${project.build.directory}/pmd-benchmark.txt.
User property is: pmd.benchmarkOutputFilename.
compileSourceRoots List 3.7 Specifies the location of the source directories to be used for PMD. Defaults to project.compileSourceRoots.
Default value is: ${project.compileSourceRoots}.
excludeFromFailureFile String 3.7 File that lists classes and rules to be excluded from failures. For PMD, this is a properties file. For CPD, this is a text file that contains comma-separated lists of classes that are allowed to duplicate.
User property is: pmd.excludeFromFailureFile.
excludeRoots File[] 2.2 The project source directories that should be excluded.
excludes List 2.2 A list of files to exclude from checking. Can contain Ant-style wildcards and double wildcards. Note that these exclusion patterns only operate on the path of a source file relative to its source root directory. In other words, files are excluded based on their package and/or class name. If you want to exclude entire source root directories, use the parameter excludeRoots instead.
format String 2.0 Set the output format type, in addition to the HTML report. Must be one of: "none", "csv", "xml", "txt" or the full class name of the PMD renderer to use. See the net.sourceforge.pmd.renderers package javadoc for available renderers. XML is required if the pmd:check goal is being used.
Default value is: xml.
User property is: format.
includeTests boolean 2.2 Run PMD on the tests.
Default value is: false.
includeXmlInSite boolean 3.0 Whether to include the xml files generated by PMD/CPD in the site.
Default value is: false.
includes List 2.2 A list of files to include from checking. Can contain Ant-style wildcards and double wildcards. Defaults to **\/*.java.
language String 3.0 The programming language to be analyzed by PMD. Valid values are currently java, javascript and jsp.
Default value is: java.
linkXRef boolean 2.0 Link the violation line numbers to the source xref. Links will be created automatically if the jxr plugin is being used.
Default value is: true.
User property is: linkXRef.
minimumPriority int 2.1 The rule priority threshold; rules with lower priority than this will not be evaluated.
Default value is: 5.
User property is: minimumPriority.
outputEncoding String 2.5 The file encoding when writing non-HTML reports.
Default value is: ${project.reporting.outputEncoding}.
User property is: outputEncoding.
renderProcessingErrors boolean 3.9.0 Also render processing errors into the HTML report. Processing errors are problems, that PMD encountered while executing the rules. It can be parsing errors or exceptions during rule execution. Processing errors indicate a bug in PMD and the information provided help in reporting and fixing bugs in PMD.
Default value is: true.
User property is: pmd.renderProcessingErrors.
renderRuleViolationPriority boolean 3.10.0 Also render the rule priority into the HTML report.
Default value is: true.
User property is: pmd.renderRuleViolationPriority.
renderViolationsByPriority boolean 3.12.0 Add a section in the HTML report, that groups the found violations by rule priority in addition to grouping by file.
Default value is: true.
User property is: pmd.renderViolationsByPriority.
rulesets String[] 2.0 The PMD rulesets to use. See the Stock Java Rulesets for a list of available rules. Defaults to a custom ruleset provided by this maven plugin (/rulesets/java/maven-pmd-plugin-default.xml).
showPmdLog boolean 3.9.0 Redirect PMD log into maven log out. When enabled, the PMD log output is redirected to maven, so that it is visible in the console together with all the other log output. Also, if maven is started with the debug flag (-X or --debug), the PMD logger is also configured for debug.
Default value is: true.
User property is: pmd.showPmdLog.
skip boolean 2.1 Skip the PMD report generation. Most useful on the command line via "-Dpmd.skip=true".
Default value is: false.
User property is: pmd.skip.
skipEmptyReport boolean 3.1 Skip the PMD/CPD report generation if there are no violations or duplications found. Defaults to true.
Default value is: true.
skipPmdError boolean 3.1 per default pmd executions error are ignored to not break the whole
Default value is: true.
User property is: pmd.skipPmdError.
sourceEncoding String 2.3 The file encoding to use when reading the Java sources.
Default value is: ${project.build.sourceEncoding}.
User property is: encoding.
suppressMarker String 3.4 Source level marker used to indicate whether a RuleViolation should be suppressed. If it is not set, PMD's default will be used, which is NOPMD. See also PMD - Suppressing warnings.
User property is: pmd.suppressMarker.
targetJdk String 2.0 The target JDK to analyze based on. Should match the source used in the compiler plugin. Valid values are currently 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 9, 10, 11, and 12.

Note: this parameter is only used if the language parameter is set to java.


Default value is: ${maven.compiler.source}.
User property is: targetJdk.
testSourceRoots List 3.7 The directories containing the test-sources to be used for PMD. Defaults to project.testCompileSourceRoots
Default value is: ${project.testCompileSourceRoots}.
typeResolution boolean 3.0 Controls whether the project's compile/test classpath should be passed to PMD to enable its type resolution feature.
Default value is: true.
User property is: pmd.typeResolution.
xrefLocation File 2.0 Location of the Xrefs to link to.
Default value is: ${project.reporting.outputDirectory}/xref.
xrefTestLocation File 2.0 Location of the Test Xrefs to link to.
Default value is: ${project.reporting.outputDirectory}/xref-test.

Parameter Details

aggregate:

Whether to build an aggregated report at the root, or build individual reports.
  • Type: boolean
  • Since: 2.2
  • Required: No
  • User Property: aggregate
  • Default: false

analysisCache:

Enables the analysis cache, which speeds up PMD. This requires a cache file, that contains the results of the last PMD run. Thus the cache is only effective, if this file is not cleaned between runs.
  • Type: boolean
  • Since: 3.8
  • Required: No
  • User Property: pmd.analysisCache
  • Default: false

analysisCacheLocation:

The location of the analysis cache, if it is enabled. This file contains the results of the last PMD run and must not be cleaned between consecutive PMD runs. Otherwise the cache is not in use. If the file doesn't exist, PMD executes as if there is no cache enabled and all files are analyzed. Otherwise only changed files will be analyzed again.
  • Type: java.lang.String
  • Since: 3.8
  • Required: No
  • User Property: pmd.analysisCacheLocation
  • Default: ${project.build.directory}/pmd/pmd.cache

benchmark:

Controls whether PMD will track benchmark information.
  • Type: boolean
  • Since: 3.1
  • Required: No
  • User Property: pmd.benchmark
  • Default: false

benchmarkOutputFilename:

Benchmark output filename.
  • Type: java.lang.String
  • Since: 3.1
  • Required: No
  • User Property: pmd.benchmarkOutputFilename
  • Default: ${project.build.directory}/pmd-benchmark.txt

compileSourceRoots:

Specifies the location of the source directories to be used for PMD. Defaults to project.compileSourceRoots.
  • Type: java.util.List
  • Since: 3.7
  • Required: No
  • Default: ${project.compileSourceRoots}

excludeFromFailureFile:

File that lists classes and rules to be excluded from failures. For PMD, this is a properties file. For CPD, this is a text file that contains comma-separated lists of classes that are allowed to duplicate.
  • Type: java.lang.String
  • Since: 3.7
  • Required: No
  • User Property: pmd.excludeFromFailureFile

excludeRoots:

The project source directories that should be excluded.
  • Type: java.io.File[]
  • Since: 2.2
  • Required: No

excludes:

A list of files to exclude from checking. Can contain Ant-style wildcards and double wildcards. Note that these exclusion patterns only operate on the path of a source file relative to its source root directory. In other words, files are excluded based on their package and/or class name. If you want to exclude entire source root directories, use the parameter excludeRoots instead.
  • Type: java.util.List
  • Since: 2.2
  • Required: No

format:

Set the output format type, in addition to the HTML report. Must be one of: "none", "csv", "xml", "txt" or the full class name of the PMD renderer to use. See the net.sourceforge.pmd.renderers package javadoc for available renderers. XML is required if the pmd:check goal is being used.
  • Type: java.lang.String
  • Since: 2.0
  • Required: No
  • User Property: format
  • Default: xml

includeTests:

Run PMD on the tests.
  • Type: boolean
  • Since: 2.2
  • Required: No
  • Default: false

includeXmlInSite:

Whether to include the xml files generated by PMD/CPD in the site.
  • Type: boolean
  • Since: 3.0
  • Required: No
  • Default: false

includes:

A list of files to include from checking. Can contain Ant-style wildcards and double wildcards. Defaults to **\/*.java.
  • Type: java.util.List
  • Since: 2.2
  • Required: No

language:

The programming language to be analyzed by PMD. Valid values are currently java, javascript and jsp.
  • Type: java.lang.String
  • Since: 3.0
  • Required: No
  • Default: java

linkXRef:

Link the violation line numbers to the source xref. Links will be created automatically if the jxr plugin is being used.
  • Type: boolean
  • Since: 2.0
  • Required: No
  • User Property: linkXRef
  • Default: true

minimumPriority:

The rule priority threshold; rules with lower priority than this will not be evaluated.
  • Type: int
  • Since: 2.1
  • Required: No
  • User Property: minimumPriority
  • Default: 5

outputDirectory:

The output directory for the final HTML report. Note that this parameter is only evaluated if the goal is run directly from the command line or during the default lifecycle. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.
  • Type: java.io.File
  • Since: 2.0
  • Required: Yes
  • User Property: project.reporting.outputDirectory

outputEncoding:

The file encoding when writing non-HTML reports.
  • Type: java.lang.String
  • Since: 2.5
  • Required: No
  • User Property: outputEncoding
  • Default: ${project.reporting.outputEncoding}

renderProcessingErrors:

Also render processing errors into the HTML report. Processing errors are problems, that PMD encountered while executing the rules. It can be parsing errors or exceptions during rule execution. Processing errors indicate a bug in PMD and the information provided help in reporting and fixing bugs in PMD.
  • Type: boolean
  • Since: 3.9.0
  • Required: No
  • User Property: pmd.renderProcessingErrors
  • Default: true

renderRuleViolationPriority:

Also render the rule priority into the HTML report.
  • Type: boolean
  • Since: 3.10.0
  • Required: No
  • User Property: pmd.renderRuleViolationPriority
  • Default: true

renderViolationsByPriority:

Add a section in the HTML report, that groups the found violations by rule priority in addition to grouping by file.
  • Type: boolean
  • Since: 3.12.0
  • Required: No
  • User Property: pmd.renderViolationsByPriority
  • Default: true

rulesets:

The PMD rulesets to use. See the Stock Java Rulesets for a list of available rules. Defaults to a custom ruleset provided by this maven plugin (/rulesets/java/maven-pmd-plugin-default.xml).
  • Type: java.lang.String[]
  • Since: 2.0
  • Required: No

showPmdLog:

Redirect PMD log into maven log out. When enabled, the PMD log output is redirected to maven, so that it is visible in the console together with all the other log output. Also, if maven is started with the debug flag (-X or --debug), the PMD logger is also configured for debug.
  • Type: boolean
  • Since: 3.9.0
  • Required: No
  • User Property: pmd.showPmdLog
  • Default: true

skip:

Skip the PMD report generation. Most useful on the command line via "-Dpmd.skip=true".
  • Type: boolean
  • Since: 2.1
  • Required: No
  • User Property: pmd.skip
  • Default: false

skipEmptyReport:

Skip the PMD/CPD report generation if there are no violations or duplications found. Defaults to true.
  • Type: boolean
  • Since: 3.1
  • Required: No
  • Default: true

skipPmdError:

per default pmd executions error are ignored to not break the whole
  • Type: boolean
  • Since: 3.1
  • Required: No
  • User Property: pmd.skipPmdError
  • Default: true

sourceEncoding:

The file encoding to use when reading the Java sources.
  • Type: java.lang.String
  • Since: 2.3
  • Required: No
  • User Property: encoding
  • Default: ${project.build.sourceEncoding}

suppressMarker:

Source level marker used to indicate whether a RuleViolation should be suppressed. If it is not set, PMD's default will be used, which is NOPMD. See also PMD - Suppressing warnings.
  • Type: java.lang.String
  • Since: 3.4
  • Required: No
  • User Property: pmd.suppressMarker

targetDirectory:

The output directory for the intermediate XML report.
  • Type: java.io.File
  • Since: 2.0
  • Required: Yes
  • User Property: project.build.directory

targetJdk:

The target JDK to analyze based on. Should match the source used in the compiler plugin. Valid values are currently 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 9, 10, 11, and 12.

Note: this parameter is only used if the language parameter is set to java.

  • Type: java.lang.String
  • Since: 2.0
  • Required: No
  • User Property: targetJdk
  • Default: ${maven.compiler.source}

testSourceRoots:

The directories containing the test-sources to be used for PMD. Defaults to project.testCompileSourceRoots
  • Type: java.util.List
  • Since: 3.7
  • Required: No
  • Default: ${project.testCompileSourceRoots}

typeResolution:

Controls whether the project's compile/test classpath should be passed to PMD to enable its type resolution feature.
  • Type: boolean
  • Since: 3.0
  • Required: No
  • User Property: pmd.typeResolution
  • Default: true

xrefLocation:

Location of the Xrefs to link to.
  • Type: java.io.File
  • Since: 2.0
  • Required: No
  • Default: ${project.reporting.outputDirectory}/xref

xrefTestLocation:

Location of the Test Xrefs to link to.
  • Type: java.io.File
  • Since: 2.0
  • Required: No
  • Default: ${project.reporting.outputDirectory}/xref-test