Apache

Docs Plugins

PMD Plugin 3.28.0 · Other versions

A Maven plugin for the PMD toolkit, that produces a report on both code rule violations and detected copy and paste fragments, as well as being able to fail the build based on these metrics.

Source
Edit this page
Wrong?
Report a problem

Violation Checking

The pmd:check and pmd:cpd-check goals allow you to configure your build to fail if any errors are found in the PMD or CPD reports respectively. In doing so you can enforce your own custom code quality rules.

The rule violations may optionally be displayed on the build output using the verbose setting.

The following code fragment enables both the standard PMD check and the CPD check in a build, during the verify phase.

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>3.28.0</version>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
              <goal>cpd-check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  ...
</project>