From d2087c0b51ea563f5a8d1c123911fc87afba77e8 Mon Sep 17 00:00:00 2001 From: Andreas Svanberg <andreass@dsv.su.se> Date: Thu, 6 Mar 2025 18:34:00 +0100 Subject: [PATCH] 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. --- checkstyle.xml | 7 +++++++ pom.xml | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 checkstyle.xml diff --git a/checkstyle.xml b/checkstyle.xml new file mode 100644 index 0000000000..bd24b31e31 --- /dev/null +++ b/checkstyle.xml @@ -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> diff --git a/pom.xml b/pom.xml index 3473242939..8567faf79d 100755 --- a/pom.xml +++ b/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> \ No newline at end of file