title: Rename a generated file in Maven before building WAR
body: <p>Fingers crossed you can help me!</p>
  
  <p>I am using <a href="http://csssprites.org/" rel="nofollow">SmartSprites</a> to combine the PNGs on my landing page into one, so that it will load quicker.</p>
  
  <p>SmartSprite will examine your CSS files, generate a CSS Sprite image, and create a new CSS file which will use this sprite image instead of the originals.  What I want to do is replace the original CSS file with the SmartSprite one automatically during my maven WAR build.</p>
  
  <p>So here's what I would like to happen:</p>
  
  <ol>
  <li>SmartSprite scans my CSS file: <em>mystyle.css</em></li>
  <li>SmartSprite create a sprite image, and creates a new <em>mystyle-sprite.css</em> file, which references the new sprite image.</li>
  <li><strong>I want to copy <em>mystyle-sprite.css</em> over <em>mystyle.css</em> before the WAR is built, so that I don't have to change any of my references in the JSP files.</strong></li>
  </ol>
  
  <p>Both files are located in the output directory (target/myproj/css).  There doesn't seem to be any flag in SmartSprite to override the original file, so I guess it had to be done post-processing.</p>
  
  <p>Below is the maven plugin configuration I'm using for SmartSprite.</p>
  
  <pre><code>        &lt;plugin&gt;
              &lt;groupId&gt;org.carrot2.labs&lt;/groupId&gt;
              &lt;artifactId&gt;smartsprites-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.0&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;phase&gt;prepare-package&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;spritify&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  </code></pre>