title: How to use Maven Checkstyle plugin in multi-module project?
body: <p>This is my parent <code>pom.xml</code> (part of it) in a multi-module project:</p>
  <pre><code>...
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-checkstyle-plugin&lt;/artifactId&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;phase&gt;compile&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;check&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  …
  </code></pre>
  <p>This configuration instructs <code>mvn</code> to execute <code>checkstyle</code> plugin in the root project <strong>and</strong> every sub-module. I don't want it to work this way. Instead, I want this plugin to be executed only for the root project, and be skipped for every sub-module. At the same time, I have many sub-modules, and I don't like the idea of explicitly skipping the plugin execution in every one of them.</p>
  <p>Documentation for Checkstyle <a href="http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/multi-module-config.html" rel="nofollow noreferrer">says</a> &quot;<em>..ensure that you do not include the Maven Checkstyle Plugin in your sub modules..</em>&quot;. But how can I ensure that if my sub-modules inherit my root <code>pom.xml</code>? I'm lost, please help.</p>