title: Maven Multi Module Resource Sharing
body: <p>I have a Maven structure that builds just fine, but I somehow struggle with my Checkstyle resources.
  The structure is as follows:</p>
  
  <ul>
  <li>Parent
  
  <ul>
  <li>Sub Parent A
  
  <ul>
  <li>Modules</li>
  </ul></li>
  <li>Sub Parent B
  
  <ul>
  <li>Modules</li>
  </ul></li>
  <li>Build Resources
  
  <ul>
  <li>src/main/resources files</li>
  </ul></li>
  </ul></li>
  </ul>
  
  <p>The parent is supposed to define everything that both sub parents have in common.
  The Checkstyle plugin has the "Build Resources" as a dependency.
  The  is defined as "/checktyle_resources/checkstyle.xml".
  I have problems with my Checkstyle plugin, because it can't find the neccessary resources, if I build the "Parent".
  If I build "Sub Parent A" or "Sub Parent B", checkstyle works fine, but of course the "Build Resources" have to be installed to the repository priorly. </p>
  
  <p>Has somebody an idea why this won't work?
  Is this Maven structure even a good idea?</p>
  
  <p>Thanks</p>
  
  <p>PS: I have seen <a href="https://stackoverflow.com/questions/14885048/share-specific-pmd-rulesets-across-multi-module-maven-project">this</a> question. And in the way the answer describes the solution it works in my project fine. But my multi-layered parent structure seems to create some kind of an issue here.</p>
  
  <p>Here is the related content of the pom.xml of the parent.</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;group&lt;/groupId&gt;
  &lt;artifactId&gt;parent&lt;/artifactId&gt;
  &lt;version&gt;1.0&lt;/version&gt;
  &lt;packaging&gt;pom&lt;/packaging&gt;
  
  &lt;properties&gt;
  
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;target.jdk&gt;1.6&lt;/target.jdk&gt;
      &lt;build.module.versions&gt;1.3&lt;/build.module.versions&gt;
      &lt;compiler.source.level&gt;${target.jdk}&lt;/compiler.source.level&gt;
      &lt;compiler.target.level&gt;${target.jdk}&lt;/compiler.target.level&gt;
      &lt;compiler.version&gt;${target.jdk}&lt;/compiler.version&gt;
      &lt;maven.version&gt;2.2.1&lt;/maven.version&gt;      
      &lt;maven.checkstyle.plugin.version&gt;2.10&lt;/maven.checkstyle.plugin.version&gt;
      &lt;checkstyle.fail.on.error&gt;false&lt;/checkstyle.fail.on.error&gt;
      &lt;junit.version&gt;4.11&lt;/junit.version&gt;
      &lt;checkstyle.version&gt;5.4&lt;/checkstyle.version&gt;
      &lt;checkstyle.skip&gt;false&lt;/checkstyle.skip&gt;
  
  &lt;/properties&gt;
  
  &lt;dependencyManagement&gt;
      &lt;dependencies&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;${junit.version}&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;group&lt;/groupId&gt;
              &lt;artifactId&gt;build-tools&lt;/artifactId&gt;
              &lt;version&gt;1.0&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/dependencyManagement&gt;
  
  
  
  &lt;build&gt;
      &lt;pluginManagement&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;version&gt;${maven.checkstyle.plugin.version}&lt;/version&gt;
  
                  &lt;dependencies&gt;
                      &lt;dependency&gt;
                          &lt;groupId&gt;com.puppycrawl.tools&lt;/groupId&gt;
                          &lt;artifactId&gt;checkstyle&lt;/artifactId&gt;
                          &lt;version&gt;${checkstyle.version}&lt;/version&gt;
                          &lt;exclusions&gt;
                              &lt;exclusion&gt;
                                  &lt;groupId&gt;com.sun&lt;/groupId&gt;
                                  &lt;artifactId&gt;tools&lt;/artifactId&gt;
                              &lt;/exclusion&gt;
                          &lt;/exclusions&gt;
                      &lt;/dependency&gt;
                      &lt;dependency&gt;
                          &lt;groupId&gt;group&lt;/groupId&gt;
                          &lt;artifactId&gt;build-tools&lt;/artifactId&gt;
                          &lt;version&gt;1.0&lt;/version&gt;
                      &lt;/dependency&gt;
                  &lt;/dependencies&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;checkstyle&lt;/id&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;checkstyle&lt;/goal&gt;
                              &lt;goal&gt;check&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
                  &lt;configuration&gt;
                      &lt;failsOnError&gt;${checkstyle.fail.on.error}&lt;/failsOnError&gt;
                      &lt;failOnViolation&gt;${checkstyle.fail.on.error}&lt;/failOnViolation&gt;
                      &lt;enableRulesSummary&gt;false&lt;/enableRulesSummary&gt;
                      &lt;configLocation&gt;/Checkstyle_Configuration/checks.xml&lt;/configLocation&gt;
                      &lt;headerLocation&gt;/Checkstyle_Configuration/file_header_java_regexp.txt&lt;/headerLocation&gt;
                      &lt;suppressionsLocation&gt;/Checkstyle_Configuration/suppressions.xml&lt;/suppressionsLocation&gt;
                      &lt;suppressionsFileExpression&gt;checkstyle.suppressions.file.donothing&lt;/suppressionsFileExpression&gt;
                      &lt;propertyExpansion&gt;checkstyle.suppressions.file=${project.build.directory}/checkstyle-suppressions.xml&lt;/propertyExpansion&gt;
                      &lt;!-- &lt;propertyExpansion&gt;checkstyle.suppressions.file=Checkstyle_Configuration/suppressions.xml&lt;/propertyExpansion&gt; --&gt;
                      &lt;includeTestSourceDirectory&gt;true&lt;/includeTestSourceDirectory&gt;
                      &lt;excludes&gt;**/*Bean.java&lt;/excludes&gt;
                      &lt;excludes&gt;**/gen*/*.java&lt;/excludes&gt;
                      &lt;skip&gt;${checkstyle.skip}&lt;/skip&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
  
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
                  &lt;version&gt;${maven.plugin.dependency.version}&lt;/version&gt;
              &lt;/plugin&gt;
  
          &lt;/plugins&gt;
  
  
      &lt;/pluginManagement&gt;
  
  
      &lt;!--************************************************************************
      * PLUGINS SECTION ************************************************************************* --&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;inherited&gt;false&lt;/inherited&gt;
              &lt;configuration &lt;configLocation&gt;/Checkstyle_Configuration/volkswagen_checks.xml&lt;/configLocation&gt;  &lt;headerLocation&gt;/Checkstyle_Configuration/file_header_java_regexp.txt&lt;/headerLocation&gt;&lt;suppressionsLocation&gt;/Checkstyle_Configuration/suppressions.xml&lt;/suppressionsLocation&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt;
              &lt;version&gt;${maven.resources.version}&lt;/version&gt;
          &lt;/plugin&gt;
  
      &lt;/plugins&gt;
  &lt;/build&gt;
  
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  &lt;!--****************************************************************************
  * MODULES SECTION ***************************************************************************** --&gt;
  
  &lt;modules&gt;
      &lt;module&gt;build-tools&lt;/module&gt;
      &lt;module&gt;sub-parent-a&lt;/module&gt;
      &lt;module&gt;sub-parent-b&lt;/module&gt;
  &lt;/modules&gt;
  </code></pre>
  
  <p></p>