Skip to content

Commit

Permalink
Fail build on CheckStyle or PMD violations.
Browse files Browse the repository at this point in the history
To see all CheckStyle and PMD violations in a maven build you need to
run maven with option `-Dcheckstyle.failOnViolation=false`
 and `-Dpmd.failOnViolation=false`.
  • Loading branch information
uhafner committed Apr 27, 2024
1 parent f720505 commit e33b429
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<pmd.version>7.0.0</pmd.version>
<maven-checkstyle-plugin.version>3.3.1</maven-checkstyle-plugin.version>
<checkstyle.version>10.15.0</checkstyle.version>
<maven-pmd-plugin.version>3.21.2</maven-pmd-plugin.version>
<maven-pmd-plugin.version>3.22.0</maven-pmd-plugin.version>
<findsecbugs-plugin.version>1.13.0</findsecbugs-plugin.version>
<pitest-maven.plugin>1.16.0</pitest-maven.plugin>
<pitest-maven.junit5.plugin>1.2.1</pitest-maven.junit5.plugin>
Expand Down Expand Up @@ -334,7 +334,7 @@
<configuration>
<linkXRef>false</linkXRef>
<excludeGeneratedSources>true</excludeGeneratedSources>
<failsOnError>false</failsOnError>
<violationSeverity>warning</violationSeverity>
<excludes>**/*Assert*.java,**/InjectedTest.java,**/Messages.java,**/*_jmh*</excludes>
</configuration>
<dependencies>
Expand All @@ -354,7 +354,7 @@
<execution>
<id>run-checkstyle-java</id>
<goals>
<goal>checkstyle</goal>
<goal>check</goal>
</goals>
<phase>verify</phase>
<configuration>
Expand All @@ -367,14 +367,15 @@
<execution>
<id>run-checkstyle-tests</id>
<goals>
<goal>checkstyle</goal>
<goal>check</goal>
</goals>
<phase>verify</phase>
<configuration>
<excludes>**/*Assert*.java,**/*_jmh*,**/module-info.java</excludes>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<configLocation>checkstyle-tests-configuration.xml</configLocation>
<outputFile>${project.build.directory}/checkstyle-tests/checkstyle-result.xml</outputFile>
<sourceDirectories></sourceDirectories>
</configuration>
</execution>
</executions>
Expand All @@ -386,13 +387,9 @@
<configuration>
<linkXRef>false</linkXRef>
<failOnViolation>false</failOnViolation>
<targetJdk>${java.version}</targetJdk>
</configuration>
<dependencies>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-compat6</artifactId>
<version>${pmd.version}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-core</artifactId>
Expand All @@ -408,11 +405,6 @@
<artifactId>pmd-javascript</artifactId>
<version>${pmd.version}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-jsp</artifactId>
<version>${pmd.version}</version>
</dependency>
<dependency>
<groupId>edu.hm.hafner</groupId>
<artifactId>codingstyle</artifactId>
Expand All @@ -425,6 +417,7 @@
<id>run-pmd-java</id>
<goals>
<goal>pmd</goal>
<goal>check</goal>
<goal>cpd</goal>
</goals>
<phase>verify</phase>
Expand All @@ -441,6 +434,7 @@
<id>run-pmd-tests</id>
<goals>
<goal>pmd</goal>
<goal>check</goal>
<goal>cpd</goal>
</goals>
<phase>verify</phase>
Expand All @@ -462,6 +456,7 @@
<id>run-pmd-javascript</id>
<goals>
<goal>pmd</goal>
<goal>check</goal>
</goals>
<phase>verify</phase>
<configuration>
Expand All @@ -480,7 +475,6 @@
</includes>
</configuration>
</execution>

</executions>
</plugin>
<plugin>
Expand Down

0 comments on commit e33b429

Please sign in to comment.