You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mb...@apache.org on 2025/04/07 20:05:22 UTC
(maven-pmd-plugin) branch master updated: Add more information about excludes
This is an automated email from the ASF dual-hosted git repository.
mbuenger pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-pmd-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new f0fe7e5 Add more information about excludes
f0fe7e5 is described below
commit f0fe7e5b3e9d8f76386cc88b0b8420823d6c497f
Author: Matthias Bünger <Bu...@users.noreply.github.com>
AuthorDate: Mon Apr 7 22:05:18 2025 +0200
Add more information about excludes
Also fix one broken link in FAQ.
---
src/site/apt/examples/violation-exclusions.apt.vm | 30 +++++++++++++++++++++++
src/site/fml/faq.fml | 4 +--
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/src/site/apt/examples/violation-exclusions.apt.vm b/src/site/apt/examples/violation-exclusions.apt.vm
index 0b512d6..947dcf2 100644
--- a/src/site/apt/examples/violation-exclusions.apt.vm
+++ b/src/site/apt/examples/violation-exclusions.apt.vm
@@ -84,3 +84,33 @@ org.apache.maven.ClassA=UnusedPrivateField,EmptyCatchBlock
org.apache.maven.ClassB=UnusedPrivateField,UnusedFormalParameter,UnusedPrivateMethod
+-----+
+
+ You can only exclude (checks for) classes through the exclusion files.
+ If you want more flexibility and exclude classes with a certain name, or whole packages,
+ for example because of generated code, you have to do this in the <<<<configuration\>>>> section of the plugin,
+ using the <<<<excludes\>>>> or <<<<excludeRoots\>>>> elements.
+
++-----+
+<project>
+ ...
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <version>${project.version}</version>
+ <configuration>
+ <excludes>
+ <exclude>**/*Bean.java</exclude>
+ <exclude>**/generated/*.java</exclude>
+ </excludes>
+ <excludeRoots>
+ <excludeRoot>target/generated-sources/stubs</excludeRoot>
+ </excludeRoots>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+ ...
+</project>
++-----+
diff --git a/src/site/fml/faq.fml b/src/site/fml/faq.fml
index c7b9f61..0eb032c 100644
--- a/src/site/fml/faq.fml
+++ b/src/site/fml/faq.fml
@@ -63,8 +63,8 @@ under the License.
<p>
If there are no violations, then by default no reports are created and the entire PMD or CPD section
is not rendered in the site. To change this behaviour, set the
- <a href="pmd-mojo.xml#skipEmptyReport">skipEmptyReport for PMD</a> or <a href="cpd-mojo#skipEmptyReport">skipEmptyReport for CPD</a>
- to <code>false</code>.
+ <a href="pmd-mojo#skipEmptyReport">skipEmptyReport for PMD</a> or <a href="cpd-mojo#skipEmptyReport">skipEmptyReport for CPD</a>
+ to <code>false</code>
</p>
</answer>
</faq>