title: Generating custom WAR archives with Maven profiles
body: <p>I need to produce different WARs from a Maven project, according to values that vary between profiles. </p>
  
  <p>For some files, I have default values that may be overwritten by configuration. For example, I might have an images folder with default images, and the "prof1" profile might overwrite some of them, while the "prof2" profile might use only the default images. </p>
  
  <p>I'm having troubles implementing this using <a href="http://maven.apache.org/plugins/maven-war-plugin/" rel="nofollow">the Maven War Plugin</a>. I listed the different webresources in the config shown below, but the values are not overridden - instead, the default images are always shown. It's probably relevant that I placed the web application files into the <code>/Webcontent/</code> directory, instead of <code>/src/main/webapp</code>; I could switch back if needed. </p>
  
  <p>Here's my maven war plugin configuration:</p>
  
  <pre><code>&lt;plugin&gt;
      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
      &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
      &lt;version&gt;2.1.1&lt;/version&gt;
      &lt;configuration&gt;
          &lt;overwrite&gt;true&lt;/overwrite&gt;
          &lt;webResources&gt;  
              &lt;resource&gt;
                  &lt;directory&gt;${basedir}/WebContent&lt;/directory&gt;
                  &lt;excludes&gt;
                      &lt;exclude&gt;**/resources/*&lt;/exclude&gt;
                  &lt;/excludes&gt;
              &lt;/resource&gt; 
              &lt;resource&gt;
                  &lt;directory&gt;${basedir}/WebContent/resources&lt;/directory&gt;
                  &lt;targetPath&gt;WEB-INF/classes&lt;/targetPath&gt;
                  &lt;filtering&gt;true&lt;/filtering&gt;
              &lt;/resource&gt;
              &lt;resource &gt;
                  &lt;directory&gt;${basedir}/version/${profile.name}&lt;/directory&gt;
              &lt;/resource&gt;
          &lt;/webResources&gt;
          &lt;archiveClasses&gt;false&lt;/archiveClasses&gt;
          &lt;archive&gt;
              &lt;manifest&gt;
                  &lt;addClasspath&gt;true&lt;/addClasspath&gt;
                  &lt;classpathPrefix /&gt;
              &lt;/manifest&gt;
          &lt;/archive&gt;
      &lt;/configuration&gt;
  &lt;/plugin&gt;
  </code></pre>