Plugin Documentation

Goals available for this plugin:

Goal Report? Description
pmd:aggregate-cpd Yes Creates a report for PMD's Copy/Paste Detector (CPD) tool in an aggregator project. It can also generate a cpd results file in any of these formats: xml, csv or txt.

See Finding duplicated code for more details.

pmd:aggregate-cpd-check No Fail the build in an aggregator project if there were any CPD violations in the source code.
pmd:aggregate-pmd Yes Creates a PMD site report in an aggregator project based on the rulesets and configuration set in the plugin. It can also generate a pmd output file aside from the site report in any of the following formats: xml, csv or txt.
pmd:aggregate-pmd-check No Fails the build in an aggregator project if there were any PMD violations in the source code.
pmd:aggregate-pmd-no-fork Yes Creates a PMD site report in an aggregator project without forking the test-compile phase again.
pmd:check No Fails the build if there were any PMD violations in the source code.
pmd:cpd Yes Creates a report for PMD's Copy/Paste Detector (CPD) tool. It can also generate a cpd results file in any of these formats: xml, csv or txt.

See Finding duplicated code for more details.

pmd:cpd-check No Fails the build if there were any CPD violations in the source code.
pmd:help No Display help information on maven-pmd-plugin.
Call mvn pmd:help -Ddetail=true -Dgoal=<goal-name> to display parameter details.
pmd:pmd Yes Creates a PMD site report based on the rulesets and configuration set in the plugin. It can also generate a pmd output file aside from the site report in any of the following formats: xml, csv or txt.

System Requirements

The following specifies the minimum requirements to run this Maven plugin:

Maven 3.2.5
JDK 1.8

Usage

You should specify the version in your project's plugin configuration:

<project>
  ...
  <build>
    <!-- To define the plugin version in your parent POM -->
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-pmd-plugin</artifactId>
          <version>3.21.2</version>
        </plugin>
        ...
      </plugins>
    </pluginManagement>
    <!-- To use the plugin goals in your POM or parent POM -->
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
      </plugin>
      ...
    </plugins>
  </build>
  ...
  <!-- To use the report goals in your POM or parent POM -->
  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>3.21.2</version>
      </plugin>
      ...
    </plugins>
  </reporting>
  ...
</project>

For more information, see "Guide to Configuring Plug-ins"