Skip to content

Commit 2714d4e

Browse files
authored
Documentation: Excludes should be placed in pluginManagement (#637 / #638)
1 parent 1dc5ad6 commit 2714d4e

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

src/site/apt/examples/violation-exclusions.apt.vm

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -89,28 +89,32 @@ org.apache.maven.ClassB=UnusedPrivateField,UnusedFormalParameter,UnusedPrivateMe
8989
If you want more flexibility and exclude classes with a certain name, or whole packages,
9090
for example because of generated code, you have to do this in the <<<<configuration\>>>> section of the plugin,
9191
using the <<<<excludes\>>>> or <<<<excludeRoots\>>>> elements.
92+
To avoid confusion, don't write those to the plugin's configuration as a <<<<build\>>>> and <<<<reporting\>>>> plugin.
93+
Instead, configure the plugin in the <<<<pluginManagement\>>>> section of your POM, so executions of the build and site lifecycle pick it up.
9294

9395
+-----+
9496
<project>
9597
...
96-
<reporting>
97-
<plugins>
98-
<plugin>
99-
<groupId>org.apache.maven.plugins</groupId>
100-
<artifactId>maven-pmd-plugin</artifactId>
101-
<version>${project.version}</version>
102-
<configuration>
103-
<excludes>
104-
<exclude>**/*Bean.java</exclude>
105-
<exclude>**/generated/*.java</exclude>
106-
</excludes>
107-
<excludeRoots>
108-
<excludeRoot>target/generated-sources/stubs</excludeRoot>
109-
</excludeRoots>
110-
</configuration>
111-
</plugin>
112-
</plugins>
113-
</reporting>
98+
<build>
99+
<pluginManagement>
100+
<plugins>
101+
<plugin>
102+
<groupId>org.apache.maven.plugins</groupId>
103+
<artifactId>maven-pmd-plugin</artifactId>
104+
<version>${project.version}</version>
105+
<configuration>
106+
<excludes>
107+
<exclude>**/*Bean.java</exclude>
108+
<exclude>**/generated/*.java</exclude>
109+
</excludes>
110+
<excludeRoots>
111+
<excludeRoot>target/generated-sources/stubs</excludeRoot>
112+
</excludeRoots>
113+
</configuration>
114+
</plugin>
115+
</plugins>
116+
</pluginManagement>
117+
</build>
114118
...
115119
</project>
116120
+-----+

0 commit comments

Comments
 (0)