As per what I saw in the documentation it tells to use <exclude-pattern></exclude-pattern>
tag for excluding some files (or packages) in the project for checking. But it does not seems to work me. I even tried the maven <excludes></excludes>
but it seems to create problem for other part of the project. So what is the ideal way to exclude a file for PMD maven check?
One of the configuration which I used in pom.xml to exclude example is as follows but it does not seems to work :-
<configuration>
<rulesets>
<exclude-pattern>.*/example/*.*</exclude-pattern>
<ruleset>${project.basedir}\ruleset\basic.xml</ruleset>
<!-- ruleset>${project.basedir}\ruleset\braces.xml</ruleset>
<ruleset>${project.basedir}\ruleset\design.xml</ruleset>
<ruleset>${project.basedir}\ruleset\controversial.xml</ruleset>
<ruleset>${project.basedir}\ruleset\coupling.xml</ruleset>
<ruleset>${project.basedir}\ruleset\clone.xml</ruleset>
<ruleset>${project.basedir}\ruleset\comments.xml</ruleset-->
</rulesets>
</configuration>
You might be seeing that only first rule is being used for checking and other are commented. That is because I am seeing a weird issue in which the build failure happens when only first rule is included but the build passes if all other rules are included along the first one.
If you want to exclude files from pmd checks your configuration should look something like this. The exclusions should be under the root of configuration not inside the rulesets tag.
<configuration>
<excludes>
<exclude>.*/example/*.*</exclude>
</excludes>
</configuration>
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