title: Copying multiple resource directories to independent target directories with maven
body: <p>The <a href="http://maven.apache.org/plugins/maven-resources-plugin/">Maven resources plugin</a>:</p>
  
  <blockquote>
    <p>This goal requires that you configure the resources to be copied, and specify the outputDirectory.</p>
  </blockquote>
  
  <p>Copy two (or more) external resource directories within the <code>basedir</code> to the build output directory using maven (see <code>blah</code> and <code>uggh</code>).</p>
  
  <pre><code>${basedir}/ 
    - pom.xml
    - blah/
    - uggh/
    - src/
      - main/..
      - test/..
    - target/
      - classes/..
      - blah/
      - uggh/
  </code></pre>
  
  <p>For example, given the directory structure above copy <code>blah</code> and <code>uggh</code> to the target directory using maven. It is easy to copy one or the other, however, the plugin only accepts a single outputDirectory. If you specify the <code>target</code> directory and both directories as resources, then the contents of each directory gets copied to <code>target</code> but not the directories themselves.</p>
  
  <p>Additional use of the plugin overwrites the initial. Also, I've tried specifying the entire <code>basedir</code> and only including the desired directories. This does not copy anything.</p>
  
  <p>Here is an example of copying a single directory:</p>
  
  <pre><code>  &lt;plugin&gt;
      &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt;
      &lt;version&gt;2.6&lt;/version&gt;
      &lt;executions&gt;
        &lt;execution&gt;
          &lt;id&gt;copy-resources&lt;/id&gt;
          &lt;phase&gt;validate&lt;/phase&gt;
          &lt;goals&gt;
            &lt;goal&gt;copy-resources&lt;/goal&gt;
          &lt;/goals&gt;
          &lt;configuration&gt;
            &lt;outputDirectory&gt;${basedir}/target/blah&lt;/outputDirectory&gt;
            &lt;resources&gt;
              &lt;resource&gt;
                  &lt;directory&gt;blah&lt;/directory&gt;
                  &lt;filtering&gt;true&lt;/filtering&gt;
              &lt;/resource&gt;
            &lt;/resources&gt;
          &lt;/configuration&gt;
        &lt;/execution&gt;
      &lt;/executions&gt;
    &lt;/plugin&gt;
  </code></pre>