title: Maven: Include file defined in parent POM?
body: <p>I have set up a parent POM for use by all my projects with standard configuration.  I've been playing with the <a href="http://code.google.com/p/maven-java-formatter-plugin/" rel="nofollow" title="maven-java-formatter-plugin">maven-java-formatter-plugin</a> and using my own formatter config file.  In the parent POM I've set this up:</p>
  
  <pre><code>    &lt;build&gt;
      ...
          &lt;!-- Format the code during process-sources --&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;com.googlecode.maven-java-formatter-plugin&lt;/groupId&gt;
              &lt;artifactId&gt;maven-java-formatter-plugin&lt;/artifactId&gt;
              &lt;version&gt;${formatter.version}&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;phase&gt;process-resources&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;format&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
              &lt;configuration&gt;
                  &lt;!-- Use plugin to compiler config vice those in formatter config 
                      file --&gt;
                  &lt;overrideConfigCompilerVersion&gt;true&lt;/overrideConfigCompilerVersion&gt;
                  &lt;compilerSource&gt;${jdk.version}&lt;/compilerSource&gt;
                  &lt;compilerCompliance&gt;${jdk.version}&lt;/compilerCompliance&gt;
                  &lt;compilerTargetPlatform&gt;${jdk.version}&lt;/compilerTargetPlatform&gt;
                  &lt;!-- Use Unix line endings --&gt;
                  &lt;lineEnding&gt;LF&lt;/lineEnding&gt;
                  &lt;!-- The formatter config file --&gt;
                  &lt;configFile&gt;${project.basedir}/formatter-config.xml&lt;/configFile&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p>But this requires that I include the formatter-config.xml in each project.  What I'd like to somehow do is automatically retrieve/copy that file from some known location (possibly another project whose only purpose is to hold this file) into all the projects automagically during the build phase.  I'm pretty sure there's a way to do this, but I can't come up with the right search terms.</p>
  
  <p><strong>EDIT (response to prunge)</strong></p>
  
  <p>I put the config file in a separate project (packaged as a jar) and added that as a dependency to my parent POM.  However, when I try to build a project that makes use of the parent POM, I get this error:</p>
  
  <pre><code>[ERROR] Failed to execute goal com.googlecode.maven-java-formatter-plugin:maven-java-formatter-plugin:0.3.1:format (default) on project TestServlet: Config file [eclipse/formatter-config.xml] cannot be found: Could not find resource 'eclipse/formatter-config.xml'. -&gt; [Help 1]
  </code></pre>
  
  <p>It appears that the formatter-config.xml file is not being resolved from the classpath as per the formatter plugin page you referenced.</p>
  
  <p>This is what I have; perhaps you can tell me where I went wrong:</p>
  
  <pre><code>CodeFormatter (builds a jar)
  |-- pom.xml
  |-- src
  |   `-- main
  |       `-- resources
  |           `-- eclipse
  |               `-- formatter-config.xml
  </code></pre>
  
  <p>Parent POM  is same as above but have added new dependency:</p>
  
  <pre><code>&lt;groupId&gt;my.company&lt;/groupId&gt;
  &lt;artifactId&gt;super-pom&lt;/artifactId&gt;
  &lt;version&gt;1.0&lt;/version&gt;
  &lt;packaging&gt;pom&lt;/packaging&gt;
  ....
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;my.company&lt;/groupId&gt;
          &lt;artifactId&gt;code-formatter&lt;/artifactId&gt;
          &lt;version&gt;1.0&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  ...
  </code></pre>
  
  <p>No changes to the TestServlet project POM; it includes the parent POM:</p>
  
  <pre><code>&lt;parent&gt;
      &lt;groupId&gt;my.company&lt;/groupId&gt;
      &lt;artifactId&gt;super-pom&lt;/artifactId&gt;
      &lt;version&gt;1.0&lt;/version&gt;
  &lt;/parent&gt;
  </code></pre>