title: Maven String Replace of Text Web Resources
body: <p>I have a Maven web application with text files in </p>
  
  <blockquote>
    <p>src/main/webapp/textfilesdir</p>
  </blockquote>
  
  <p>As I understand it, during the package phase this textfilesdir directory will be copied into the</p>
  
  <blockquote>
    <p>target/project-1.0-SNAPSHOT </p>
  </blockquote>
  
  <p>directory, which is then zipped up into a </p>
  
  <blockquote>
    <p>target/project-1.0-SNAPSHOT.war</p>
  </blockquote>
  
  <p><strong>Problem</strong></p>
  
  <p>Now, I need to do a string replacement on the contents of the text files in target/project-1.0-SNAPSHOT/textfilesdir. This must then be done after the textfilesdir is copied into target/project-1.0-SNAPSHOT, but prior to the target/project-1.0-SNAPSHOT.war file being created. I believe this is all done during the package phase.</p>
  
  <p>How can a plugin (potentially maven-antrun-plugin), plug into the package phase to do this.</p>
  
  <p>The text files don't contain properties, like ${property-name} to filter on. String replacement is likely the only option.</p>
  
  <p><strong>Options</strong></p>
  
  <ol>
  <li><p>Modify the text files after the copy into target/project-1.0-SNAPSHOT directory, yet prior to the WAR creation.</p></li>
  <li><p>After packaging, extract the text files from WAR, modify them, and add them back into the WAR.</p></li>
  </ol>
  
  <p>I'm thinking there is another option here I'm missing. Thoughts anyone?</p>