I'm trying to use the Maven Checkstyle plugin with an external configuration file. The plugin works with or without specifying an external configuration file, and the checksytle warnings are different depending on if configLocation is set. So it seems like it should be working fine, but it's not. No matter what I enter in the external configuration file, the same warnings appear to be generated. In fact, I can clear out the file completely and nothing appears to change.
In the pom:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<configuration>
<configLocation>google_checks.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
</configuration>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
Trying to use this file:
https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml
In the pom, if I change the name to say "does_not_exist.xml" it will report it cannot find the file with the following message:
Unable to find configuration file at location: does_not_exist.xml
Since it does not print this message with the correct file name, it tells me it can find the file with the correct name (google_checks.xml).
In the file:
<module name="LineLength">
<property name="max" value="100"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
If I change the value to say 10, I still get the warning:
Line is longer than 100 characters...
I'm running:
mvn clean verify
I've tried putting the google_checks.xml file in the root of the project and in the src/main/resources directory. Same results either location.
I'd ultimately like to change the rules for line length and indentation, but since it doesn't care what I enter in the file, I'm not sure how to do this. Any ideas on how to make it honor what's in the external file?