title: Selecting the certain resource files into WAR from the default src/main/resources location with Maven
body: <p>I am trying to control which files make into the WAR package that is created by <code>mvn package</code> goal. Specifically, I want to exclude some files from the default <code>src/main/resources</code> folder for each package (I am trying to do builds/package for different environments).</p>
  <p>I tried using maven-war-plugin but failed. If I add this configuration (for testing):</p>
  <pre><code>&lt;webResources&gt;
      &lt;resource&gt;
          &lt;directory&gt;src/main/resources&lt;/directory&gt;
          &lt;targetPath&gt;WEB-INF/classes&lt;/targetPath&gt;
          &lt;excludes&gt;
              &lt;exclude&gt;*.xml&lt;/exclude&gt;
          &lt;/excludes&gt;
      &lt;/resource&gt;
  &lt;/webResources&gt;
  </code></pre>
  <p>...my <code>WEB-INF/classes</code> will still contain the XML files. This is because <code>webResources</code> parameter seems to duplicate the copying process (the above configuration actually works, an files are not copied... but they get copied in some <em>other</em> process instead).</p>
  <p><a href="http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html" rel="noreferrer">Maven-war-plugin documentation</a> states:</p>
  <blockquote>
  <p>The default resource directory for all Maven 2 projects is src/main/resources which will end up in target/classes and in WEB-INF/classes in the WAR. The directory structure will be preserved in the process.</p>
  <p>The WAR Plugin is also capable of including resources not found in the default resource directory through the webResources parameter.</p>
  </blockquote>
  <p>This is a bit confusing. Does it mean that:</p>
  <ul>
  <li>The <code>webResources</code> parameter is a feature in maven-war-plugin that allows files to be included <em>only</em> from outside <code>src/main/resources</code> folder? If so, how can we alter the copied files from inside <code>src/main/resources</code>?</li>
  <li>The <code>webResources</code> parameter is a feature in maven-war-plugin that allows files to be included <em>also</em> from outside <code>src/main/resources</code> folder? If so, how can it be configured to do this?</li>
  <li>Some other option?</li>
  </ul>