pmd:cpd

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

Full name:

org.apache.maven.plugins:maven-pmd-plugin:2.7.1:cpd

Description:

Creates a report for PMD's CPD tool. See http://pmd.sourceforge.net/cpd.html for more detail.

Attributes:

  • Requires a Maven project to be executed.
  • The goal is thread-safe and supports parallel builds.
  • 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.
targetDirectory File 2.0 The output directory for the intermediate XML report.

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.
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.
ignoreIdentifiers boolean 2.5 Similar to ignoreLiterals but for identifiers; i.e., variable names, methods names, and so forth.
Default value is: false.
ignoreLiterals boolean 2.5 If true, CPD ignores literal value differences when evaluating a duplicate block. This means that foo=42; and foo=43; will be seen as equivalent. You may want to run PMD with this option off to start with and then switch it on to see what it turns up.
Default value is: false.
includeTests boolean 2.2 Run PMD on the tests.
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.
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.
minimumTokens int 2.0 The minimum number of tokens that need to be duplicated before it causes a violation.
Default value is: 100.
outputEncoding String 2.5 The file encoding when writing non-HTML reports.
Default value is: ${project.reporting.outputEncoding}.
skip boolean 2.1 Skip the CPD report generation. Most useful on the command line via "-Dcpd.skip=true".
Default value is: false.
sourceEncoding String 2.3 The file encoding to use when reading the Java sources.
Default value is: ${project.build.sourceEncoding}.
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
  • Expression: ${aggregate}
  • Default: false

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
  • Expression: ${format}
  • Default: xml

ignoreIdentifiers:

Similar to ignoreLiterals but for identifiers; i.e., variable names, methods names, and so forth.
  • Type: boolean
  • Since: 2.5
  • Required: No
  • Expression: ${cpd.ignoreIdentifiers}
  • Default: false

ignoreLiterals:

If true, CPD ignores literal value differences when evaluating a duplicate block. This means that foo=42; and foo=43; will be seen as equivalent. You may want to run PMD with this option off to start with and then switch it on to see what it turns up.
  • Type: boolean
  • Since: 2.5
  • Required: No
  • Expression: ${cpd.ignoreLiterals}
  • Default: false

includeTests:

Run PMD on the tests.
  • Type: boolean
  • Since: 2.2
  • 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

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
  • Expression: ${linkXRef}
  • Default: true

minimumTokens:

The minimum number of tokens that need to be duplicated before it causes a violation.
  • Type: int
  • Since: 2.0
  • Required: No
  • Expression: ${minimumTokens}
  • Default: 100

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
  • Expression: ${project.reporting.outputDirectory}

outputEncoding:

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

skip:

Skip the CPD report generation. Most useful on the command line via "-Dcpd.skip=true".
  • Type: boolean
  • Since: 2.1
  • Required: No
  • Expression: ${cpd.skip}
  • Default: false

sourceEncoding:

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

targetDirectory:

The output directory for the intermediate XML report.
  • Type: java.io.File
  • Since: 2.0
  • Required: Yes
  • Expression: ${project.build.directory}

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