title: Use Maven to Copy Files to WEB-INF Before WAR is Packaged
body: <p>I have two servlet config files in my webapp, one for our normal environment (Heroku) and the other for WebLogic. I have a Maven profile for our WebLogic builds that should copy "servlet-context.xml.weblogic" to "servlet-context.xml". Everything appears to be working, except that the copy takes place AFTER the war file is built, so the correct servlet context doesn't get included in the package. What is the right build phase to use in the maven-antrun-plugin to get the copying done correctly?</p>
  
  <p>Here is the relevant section of my POM.xml file:</p>
  
  <pre><code>&lt;plugin&gt;
    &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
    &lt;executions&gt;
      &lt;execution&gt;
      &lt;phase&gt;test&lt;/phase&gt;
      &lt;goals&gt;
        &lt;goal&gt;run&lt;/goal&gt;
      &lt;/goals&gt;
      &lt;configuration&gt;
        &lt;tasks&gt;
          &lt;move
            file="${project.build.directory}/${project.build.finalName}/WEB-INF/spring/appServlet/radio-context.xml.weblogic"
            tofile="${project.build.directory}/${project.build.finalName}/WEB-INF/spring/appServlet/radio-context.xml"/&gt;
        &lt;/tasks&gt;
      &lt;/configuration&gt;
      &lt;/execution&gt;
    &lt;/executions&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>This fails with the following error:</p>
  
  <pre><code>Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:run (default) on project radio: An Ant BuildException has occured: Warning: Could not find file C:\workspace\radio\target\radio-1.0.0-BUILD-SNAPSHOT\WEB-INF\spring\appServlet\radio-context.xml.weblogic to copy. -&gt; [Help 1]
  </code></pre>
  
  <p>However, if I change the <code>&lt;phase&gt;</code> to <code>package</code>, the copy works, but after the war is built.</p>
  
  <p>Any help would be appreciated.</p>