setup spotbugs

Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
diff --git a/bundles/pom.xml b/bundles/pom.xml
index 396a54b..22b7e01 100644
--- a/bundles/pom.xml
+++ b/bundles/pom.xml
@@ -33,6 +33,7 @@
     <properties>
         <eclipselink.unzip.subdir>stage</eclipselink.unzip.subdir>
         <jdoc.doclint>-missing</jdoc.doclint>
+        <spotbugs.skip>true</spotbugs.skip>
     </properties>
 
     <modules>
diff --git a/pom.xml b/pom.xml
index 157e45b..77b7b1f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -104,6 +104,12 @@
         <comp.xdoclint>-Xdoclint:none</comp.xdoclint>
         <warn.limit>150</warn.limit>
 
+        <spotbugs.common>${project.build.directory}/spotbugs-exclude-common.xml</spotbugs.common>
+        <spotbugs.exclude/>
+        <spotbugs.skip>false</spotbugs.skip>
+        <spotbugs.threshold>Normal</spotbugs.threshold>
+        <spotbugs.version>4.3.0</spotbugs.version>
+
         <!-- PROJECT Properties -->
         <build.type>SNAPSHOT</build.type>
         <maven.build.timestamp.format>yyyyMMddHHmm</maven.build.timestamp.format>
@@ -1187,6 +1193,17 @@
                         </checkstyleRules>
                     </configuration>
                 </plugin>
+                <plugin>
+                    <groupId>com.github.spotbugs</groupId>
+                    <artifactId>spotbugs-maven-plugin</artifactId>
+                    <version>${spotbugs.version}</version>
+                    <configuration>
+                        <skip>${spotbugs.skip}</skip>
+                        <threshold>${spotbugs.threshold}</threshold>
+                        <excludeFilterFile>${spotbugs.common},${spotbugs.exclude}</excludeFilterFile>
+                        <fork>true</fork>
+                    </configuration>
+                </plugin>
             </plugins>
         </pluginManagement>
 
@@ -1214,20 +1231,7 @@
                 <artifactId>maven-assembly-plugin</artifactId>
                 <executions>
                     <execution>
-                        <id>common-license</id>
-                        <phase>generate-resources</phase>
-                        <goals>
-                            <goal>single</goal>
-                        </goals>
-                        <inherited>false</inherited>
-                        <configuration>
-                            <descriptors>
-                                <descriptor>src/main/assembly/common-license.xml</descriptor>
-                            </descriptors>
-                        </configuration>
-                    </execution>
-                    <execution>
-                        <id>test-defaults</id>
+                        <id>build-resources</id>
                         <phase>initialize</phase>
                         <goals>
                             <goal>single</goal>
@@ -1235,7 +1239,9 @@
                         <inherited>false</inherited>
                         <configuration>
                             <descriptors>
+                                <descriptor>src/main/assembly/common-license.xml</descriptor>
                                 <descriptor>src/main/assembly/test-defaults.xml</descriptor>
+                                <descriptor>src/main/assembly/spotbugs-filter.xml</descriptor>
                             </descriptors>
                         </configuration>
                     </execution>
@@ -1283,6 +1289,25 @@
                             </artifactItems>
                         </configuration>
                     </execution>
+                    <execution>
+                        <id>unpack-spotbugs-filter</id>
+                        <phase>initialize</phase>
+                        <goals>
+                            <goal>unpack</goal>
+                        </goals>
+                        <configuration>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>${project.groupId}</groupId>
+                                    <artifactId>org.eclipse.persistence.parent</artifactId>
+                                    <version>${project.version}</version>
+                                    <classifier>spotbugs-filter</classifier>
+                                    <type>zip</type>
+                                    <outputDirectory>${project.build.directory}</outputDirectory>
+                                </artifactItem>
+                            </artifactItems>
+                        </configuration>
+                    </execution>
                 </executions>
             </plugin>
             <plugin>
diff --git a/src/main/assembly/spotbugs-filter.xml b/src/main/assembly/spotbugs-filter.xml
new file mode 100644
index 0000000..79164c9
--- /dev/null
+++ b/src/main/assembly/spotbugs-filter.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0 which is available at
+    http://www.eclipse.org/legal/epl-2.0,
+    or the Eclipse Distribution License v. 1.0 which is available at
+    http://www.eclipse.org/org/documents/edl-v10.php.
+
+    SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
+
+-->
+
+<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
+    <id>spotbugs-filter</id>
+    <formats>
+        <format>zip</format>
+    </formats>
+    <includeBaseDirectory>false</includeBaseDirectory>
+    <fileSets>
+        <fileSet>
+            <directory>${project.basedir}/src/main/resources</directory>
+            <outputDirectory>.</outputDirectory>
+            <includes>
+                <include>*.xml</include>
+            </includes>
+        </fileSet>
+    </fileSets>
+</assembly>
\ No newline at end of file
diff --git a/src/main/resources/spotbugs-exclude-common.xml b/src/main/resources/spotbugs-exclude-common.xml
new file mode 100644
index 0000000..6aa7eee9
--- /dev/null
+++ b/src/main/resources/spotbugs-exclude-common.xml
@@ -0,0 +1,14 @@
+<!--
+
+    Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Distribution License v. 1.0, which is available at
+    http://www.eclipse.org/org/documents/edl-v10.php.
+
+    SPDX-License-Identifier: BSD-3-Clause
+
+-->
+
+<FindBugsFilter>
+</FindBugsFilter>
diff --git a/testing/server/pom.xml b/testing/server/pom.xml
index 5a1d42d..a93a13c 100644
--- a/testing/server/pom.xml
+++ b/testing/server/pom.xml
@@ -30,6 +30,10 @@
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
+    <properties>
+        <spotbugs.skip>true</spotbugs.skip>
+    </properties>
+
     <build>
         <plugins>
             <!--Download and unpack JEE server automatically if property skip.jee.server.installation=false-->