We’re checking our code using the PMD ‘check’ goal that is bound to the ‘verify’ life cycle. (http://maven.apache.org/plugins/maven-pmd-plugin/examples/violationChecking.html)
For the ‘pmd’ goal you can add ‘excludes’ and ‘excludeRoots’ but not for the ‘check’ goal.
How does one exclude eg. generated sources directories?
You need to do the pmd:pmd first and afterwards do a pmd:check. You can configure that simply by using. Bind that to a particular lifecycle-phase which is before verify. For example into package or pre-integration-test phase.
The check goals (check, cpd-check are exactly intended to fail a build if there are some violations. So you can define some exceptions for the pmd goal which folders should be included/excluded.