Skip to content

Commit

Permalink
setup spotbugs
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
  • Loading branch information
lukasj committed Sep 4, 2021
1 parent dcf6d66 commit 99549fa
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 14 deletions.
1 change: 1 addition & 0 deletions bundles/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<properties>
<eclipselink.unzip.subdir>stage</eclipselink.unzip.subdir>
<jdoc.doclint>-missing</jdoc.doclint>
<spotbugs.skip>true</spotbugs.skip>
</properties>

<modules>
Expand Down
53 changes: 39 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>

Expand Down Expand Up @@ -1214,28 +1231,17 @@
<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>
</goals>
<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>
Expand Down Expand Up @@ -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>
Expand Down
33 changes: 33 additions & 0 deletions src/main/assembly/spotbugs-filter.xml
Original file line number Diff line number Diff line change
@@ -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>
14 changes: 14 additions & 0 deletions src/main/resources/spotbugs-exclude-common.xml
Original file line number Diff line number Diff line change
@@ -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>
4 changes: 4 additions & 0 deletions testing/server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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-->
Expand Down

0 comments on commit 99549fa

Please sign in to comment.