------ Tips for Maven 2 Checkstyle Plugin ------ Tips for Maven 2 Checkstyle Plugin * Multimodule Configuration. Configuring the Checkstyle plugin for use within a large multimodule projects can be done, but will require a little setup. Example will use a mysterious project called 'whizbang'. ------------------- [whizbang]$ ls drwxr-xr-x+ 5 0 Nov 3 15:36 core/ drwxr-xr-x+ 6 0 Nov 16 16:11 gui/ drwxr-xr-x+ 6 0 Nov 29 13:13 jmx/ -rw-r--r-- 1 6153 Nov 29 13:08 pom.xml drwxr-xr-x+ 4 0 Nov 1 15:48 src/ ------------------- First: setup a sub project to house your build tools. ------------------- [whizbang]$ ls drwxr-xr-x+ 4 0 Nov 29 13:44 build-tools/ drwxr-xr-x+ 5 0 Nov 3 15:36 core/ drwxr-xr-x+ 6 0 Nov 16 16:11 gui/ drwxr-xr-x+ 6 0 Nov 29 13:13 jmx/ -rw-r--r-- 1 6153 Nov 29 13:08 pom.xml drwxr-xr-x+ 4 0 Nov 1 15:48 src/ ------------------- Next, include the resources you want in the build-tools jar file. ------------------- [whizbang/build-tools]$ find . -type f ./pom.xml ./src/main/resources/whizbang/checkstyle.xml ./src/main/resources/whizbang/pmd.xml ./src/main/resources/whizbang/LICENSE.txt ------------------- TIP: put the resources into a subdirectory that you can ensure will be unique, and not conflict with anyone else. Now, include the checkstyle configuration in the top level pom.xml ------------------- [whizbang]$ cat pom.xml 4.0.0 com.example.whizbang whizbang-parent 1.0 pom WhizBang Parent org.apache.maven.plugins maven-checkstyle-plugin whizbang/checkstyle.xml whizbang/LICENSE.txt org.apache.maven.plugins maven-checkstyle-plugin com.example.whizbang build-tools 1.0 build-tools core jmx gui ------------------- Once you are done with that, ensure that you do not include the maven-checkstyle-plugin in your sub modules, as their definition and configuration, will override the top level parent pom's definition. Lastly, kick off a build of the site. ------------------- [whizbang]$ mvn site ------------------- Every sub project will use the same checkstyle setup and configuration.