Plugin Documentation

This report describes goals, parameters details, requirements and sample usage of this plugin.

Goals

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.6.3
JDK 1.8

System Requirements History

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

Plugin Version Maven JDK
3.23.0 3.6.3 8
from 3.17.0 to 3.22.0 3.2.5 8
3.16.0 3.1.1 8
3.15.0 3.1.0 8
from 3.9.0 to 3.14.0 3.0 7
from 3.7 to 3.8 2.2.1 7
from 3.2 to 3.6 2.2.1 6
from 2.7 to 3.1 2.2.1 5
2.6 2.0.6 5
from 2.3 to 2.5 2.0.6 1.4
from 2.1 to 2.2 2.0 -
from 2.0-alpha-2 to 2.0 - -

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.23.0</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.23.0</version>
      </plugin>
      ...
    </plugins>
  </reporting>
  ...
</project>

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