Violation Exclusions

Since version 3.0 it is possible to excluse some sources from pmd/cpd check to prevent failure.

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>3.2.6</version>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
            </goals>
            <configuration>
              <excludeFromFailureFile>exclude-pmd.properties</excludeFromFailureFile>
            </configuration>
          </execution>
          <execution>
            <goals>
              <goal>cpd-check</goal>
            </goals>
            <configuration>
              <excludeFromFailureFile>exclude-cpd.properties</excludeFromFailureFile>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  ...
</project>

For cpd check, you can exclude classes to not verify. The properties file must have the following format:

org.apache.maven.ClassA,org.apache.maven.ClassB

For pmd check, you can exclude rules per classes. The properties file must have the following format:

org.apache.maven.ClassA=UnusedPrivateField,EmptyCatchBlock
org.apache.maven.ClassB=UnusedPrivateField,UnusedFormalParameter,UnusedPrivateMethod