Using a Custom Checkstyle Checker Configuration
A custom Checker configuration xml file can be defined and then referenced via a URL, File, or build classpath resource reference.
To reference a custom Checkstyle Checker configuration, use the configLocation
parameter.
<project> ... <reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>3.6.0</version> <configuration> <configLocation>checkstyle.xml</configLocation> </configuration> </plugin> </plugins> </reporting> ... </project>
This example causes the Checkstyle Plugin to check for a File named checkstyle.xml
or a resource named checkstyle.xml
within the compile scope of the dependencies or build extensions classpath.
There are 2 predefined Checkstyle configuration definitions that ship with the Checkstyle Plugin, the Sun Microsystems Definition is selected by default.
- sun_checks.xml - Sun Microsystems Definition (default).
- google_checks.xml - Google Definition.