Fix CheckStyle for individual module builds

This commit is contained in:
filoghost 2020-10-03 13:31:15 +02:00
parent 794f3faee1
commit ca9f45810a
2 changed files with 23 additions and 5 deletions

View File

@ -9,14 +9,14 @@
<property name="severity" value="warning"/> <property name="severity" value="warning"/>
<module name="SuppressionFilter"> <module name="SuppressionFilter">
<property name="file" value="checkstyle/suppressions.xml"/> <property name="file" value="${samedir}/suppressions.xml"/>
</module> </module>
<!-- Check that Java source files have the correct header --> <!-- Check that Java source files have the correct header -->
<module name="Header"> <module name="Header">
<property name="severity" value="error"/> <property name="severity" value="error"/>
<property name="fileExtensions" value="java"/> <property name="fileExtensions" value="java"/>
<property name="headerFile" value="checkstyle/header.txt"/> <property name="headerFile" value="${samedir}/header.txt"/>
</module> </module>
<!-- Check that files don't contain tabs --> <!-- Check that files don't contain tabs -->

24
pom.xml
View File

@ -175,13 +175,31 @@
</pluginManagement> </pluginManagement>
<plugins> <plugins>
<plugin>
<groupId>org.commonjava.maven.plugins</groupId>
<artifactId>directory-maven-plugin</artifactId>
<version>0.3.1</version>
<inherited>true</inherited>
<executions>
<execution>
<id>set-root-dir</id>
<phase>validate</phase>
<goals>
<goal>highest-basedir</goal>
</goals>
<configuration>
<property>rootDir</property>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId> <artifactId>maven-checkstyle-plugin</artifactId>
<configuration> <configuration>
<configLocation>checkstyle/checkstyle.xml</configLocation> <configLocation>${rootDir}/checkstyle/checkstyle.xml</configLocation>
<suppressionsLocation>checkstyle/suppressions.xml</suppressionsLocation> <propertyExpansion>samedir=${rootDir}/checkstyle</propertyExpansion>
<headerLocation>checkstyle/header.txt</headerLocation>
<sourceDirectories> <sourceDirectories>
<sourceDirectory>${project.basedir}</sourceDirectory> <sourceDirectory>${project.basedir}</sourceDirectory>
</sourceDirectories> </sourceDirectories>