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.0</version>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
              <goal>cpd-check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  ...
</project>