I have a normal buildscript for Gradle set up, and one thing I want to do is have the version of my build specified. This is the code I've set up to replace the version token in my main Java source file:
import org.apache.tools.ant.filters.ReplaceTokens
processResources {
from (sourceSets.main.java) {
include 'T145/myproj/Main.java'
filter(ReplaceTokens, tokens: ['@VERSION@' : project.version])
}
}
However it doesn't work. I tried using the replace
function, but that didn't prove to be a success either. My Main.java
has a public variable VERSION
that equals @VERSION@
, and that is what I want to be replaced.