Add checkstyle checking during Maven build

So far no rules are activated and it just puts the infrastructure in places.
Rules can be added in separately after discussion among the developers, along
with fixing all the violations of the newly activated rules.
This commit is contained in:
Andreas Svanberg 2025-03-06 18:34:00 +01:00
parent 23e0a7f5ea
commit d2087c0b51
2 changed files with 29 additions and 0 deletions

7
checkstyle.xml Normal file

@ -0,0 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
</module>

22
pom.xml

@ -211,6 +211,11 @@
<artifactId>maven-war-plugin</artifactId>
<version>3.4.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.6.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
@ -312,6 +317,23 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<failOnViolation>true</failOnViolation>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>process-sources</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>