title: Replace token in file before building, but keep token in sources
body: <p>I want to replace a <code>@VERSION@</code> token in a java source file with a version before building (Gradle is my build system of choice).</p>
  
  <p>In my current script <code>ant.replace(file: 'src/main/java/randers/notenoughvocab/main/Reference.java', token: '@VERSION@', value: version)</code> it replaces the occurrences of <code>@VERSION@</code> in the actual source file, so after a build all occurrences of the pattern have been replaced by the version and if I change the version the the gradle build file it will no longer find any patterns in there and the version will not update.</p>
  
  <p>I have also seen a task <a href="http://gradle.org/docs/current/userguide/userguide_single.html#filterOnCopy" rel="noreferrer">here</a>, but I do not get what values need to be applied for my specific project.</p>
  
  <p>The project layout for my project, if that is needed:<br>
  <img src="https://i.imgur.com/yT2J28R.png" alt="Screenshot of file layout taken from IntelliJ IDEA 14.1.2, Dark theme"></p>