|
| 1 | +<!-- |
| 2 | + STATIC ANALYSIS POM.XML ADDITIONS |
| 3 | + |
| 4 | + Add these configurations to your root pom.xml to enable all static analysis tools. |
| 5 | + Replace the existing spotbugs plugin configuration if present. |
| 6 | +--> |
| 7 | + |
| 8 | +<!-- ============================================== --> |
| 9 | +<!-- 1. ADD TO <properties> SECTION --> |
| 10 | +<!-- ============================================== --> |
| 11 | +<checkstyle.version>10.12.5</checkstyle.version> |
| 12 | +<maven-checkstyle-plugin.version>3.3.1</maven-checkstyle-plugin.version> |
| 13 | +<maven-pmd-plugin.version>3.21.2</maven-pmd-plugin.version> |
| 14 | +<pmd.version>6.55.0</pmd.version> |
| 15 | +<dependency-check-maven.version>9.0.7</dependency-check-maven.version> |
| 16 | + |
| 17 | + |
| 18 | +<!-- ============================================== --> |
| 19 | +<!-- 2. ADD TO <build><pluginManagement><plugins> --> |
| 20 | +<!-- ============================================== --> |
| 21 | +<plugin> |
| 22 | + <groupId>org.apache.maven.plugins</groupId> |
| 23 | + <artifactId>maven-checkstyle-plugin</artifactId> |
| 24 | + <version>${maven-checkstyle-plugin.version}</version> |
| 25 | + <dependencies> |
| 26 | + <dependency> |
| 27 | + <groupId>com.puppycrawl.tools</groupId> |
| 28 | + <artifactId>checkstyle</artifactId> |
| 29 | + <version>${checkstyle.version}</version> |
| 30 | + </dependency> |
| 31 | + </dependencies> |
| 32 | +</plugin> |
| 33 | +<plugin> |
| 34 | + <groupId>org.apache.maven.plugins</groupId> |
| 35 | + <artifactId>maven-pmd-plugin</artifactId> |
| 36 | + <version>${maven-pmd-plugin.version}</version> |
| 37 | + <dependencies> |
| 38 | + <dependency> |
| 39 | + <groupId>net.sourceforge.pmd</groupId> |
| 40 | + <artifactId>pmd-core</artifactId> |
| 41 | + <version>${pmd.version}</version> |
| 42 | + </dependency> |
| 43 | + <dependency> |
| 44 | + <groupId>net.sourceforge.pmd</groupId> |
| 45 | + <artifactId>pmd-java</artifactId> |
| 46 | + <version>${pmd.version}</version> |
| 47 | + </dependency> |
| 48 | + </dependencies> |
| 49 | +</plugin> |
| 50 | +<plugin> |
| 51 | + <groupId>org.owasp</groupId> |
| 52 | + <artifactId>dependency-check-maven</artifactId> |
| 53 | + <version>${dependency-check-maven.version}</version> |
| 54 | +</plugin> |
| 55 | + |
| 56 | + |
| 57 | +<!-- ============================================== --> |
| 58 | +<!-- 3. ADD TO <build><plugins> SECTION --> |
| 59 | +<!-- (or UPDATE existing spotbugs configuration) --> |
| 60 | +<!-- ============================================== --> |
| 61 | + |
| 62 | +<!-- SpotBugs - Bug Detection --> |
| 63 | +<plugin> |
| 64 | + <groupId>com.github.spotbugs</groupId> |
| 65 | + <artifactId>spotbugs-maven-plugin</artifactId> |
| 66 | + <configuration> |
| 67 | + <effort>Max</effort> |
| 68 | + <threshold>Low</threshold> |
| 69 | + <xmlOutput>true</xmlOutput> |
| 70 | + <excludeFilterFile>.github/spotbugs-exclude.xml</excludeFilterFile> |
| 71 | + <failOnError>false</failOnError> |
| 72 | + </configuration> |
| 73 | +</plugin> |
| 74 | + |
| 75 | +<!-- Checkstyle - Code Style --> |
| 76 | +<plugin> |
| 77 | + <groupId>org.apache.maven.plugins</groupId> |
| 78 | + <artifactId>maven-checkstyle-plugin</artifactId> |
| 79 | + <configuration> |
| 80 | + <configLocation>google_checks.xml</configLocation> |
| 81 | + <suppressionsLocation>.github/checkstyle-suppressions.xml</suppressionsLocation> |
| 82 | + <suppressionsFileExpression>checkstyle.suppressions.file</suppressionsFileExpression> |
| 83 | + <consoleOutput>true</consoleOutput> |
| 84 | + <failsOnError>false</failsOnError> |
| 85 | + <violationSeverity>warning</violationSeverity> |
| 86 | + </configuration> |
| 87 | +</plugin> |
| 88 | + |
| 89 | +<!-- PMD - Code Quality --> |
| 90 | +<plugin> |
| 91 | + <groupId>org.apache.maven.plugins</groupId> |
| 92 | + <artifactId>maven-pmd-plugin</artifactId> |
| 93 | + <configuration> |
| 94 | + <rulesets> |
| 95 | + <ruleset>.github/pmd-ruleset.xml</ruleset> |
| 96 | + </rulesets> |
| 97 | + <printFailingErrors>true</printFailingErrors> |
| 98 | + <failOnViolation>false</failOnViolation> |
| 99 | + <linkXRef>false</linkXRef> |
| 100 | + <sourceEncoding>UTF-8</sourceEncoding> |
| 101 | + <minimumTokens>100</minimumTokens> |
| 102 | + <targetJdk>21</targetJdk> |
| 103 | + </configuration> |
| 104 | +</plugin> |
| 105 | + |
| 106 | + |
| 107 | +<!-- ============================================== --> |
| 108 | +<!-- OPTIONAL: Add to <reporting><plugins> for site generation --> |
| 109 | +<!-- ============================================== --> |
| 110 | +<reporting> |
| 111 | + <plugins> |
| 112 | + <plugin> |
| 113 | + <groupId>com.github.spotbugs</groupId> |
| 114 | + <artifactId>spotbugs-maven-plugin</artifactId> |
| 115 | + </plugin> |
| 116 | + <plugin> |
| 117 | + <groupId>org.apache.maven.plugins</groupId> |
| 118 | + <artifactId>maven-checkstyle-plugin</artifactId> |
| 119 | + <reportSets> |
| 120 | + <reportSet> |
| 121 | + <reports> |
| 122 | + <report>checkstyle</report> |
| 123 | + </reports> |
| 124 | + </reportSet> |
| 125 | + </reportSets> |
| 126 | + </plugin> |
| 127 | + <plugin> |
| 128 | + <groupId>org.apache.maven.plugins</groupId> |
| 129 | + <artifactId>maven-pmd-plugin</artifactId> |
| 130 | + </plugin> |
| 131 | + <plugin> |
| 132 | + <groupId>org.jacoco</groupId> |
| 133 | + <artifactId>jacoco-maven-plugin</artifactId> |
| 134 | + <reportSets> |
| 135 | + <reportSet> |
| 136 | + <reports> |
| 137 | + <report>report</report> |
| 138 | + </reports> |
| 139 | + </reportSet> |
| 140 | + </reportSets> |
| 141 | + </plugin> |
| 142 | + </plugins> |
| 143 | +</reporting> |
0 commit comments