Violation Exclusions

It is possible to exclude some sources from PMD/CPD check to prevent failures.

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>3.11.0</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