I am trying to finetune our CI and I can't figure out how to avoid that PMD reports violations on generated code (not talking about Android R file there) in src-gen:
I used mvn help:effective-pom to verify my config, and the POM looks like I should. It point to right folder to exclude.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>${pmd-maven-plugin.version}</version>
<configuration>
<linkXref>false</linkXref>
<sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
<minimumTokens>${pmd.minimum.tokens}</minimumTokens>
<targetJdk>${pmd.target.jdk}</targetJdk>
<excludes>
<exclude>**/*R.java</exclude>
<exclude>**/*Manifest.java</exclude>
<excludeRoots>
<excludeRoot>${basedir}/src-gen</excludeRoot>
</excludeRoots>
</excludes>
Looking at the example (end of the page) at the PMD plugin Usage doc page suggests that the <excludeRoots> part should be directly under <configuration>, not under <excludes>.
If that does not help, maybe try <excludeRoot>**/src-gen/**</excludeRoot> instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With