I am trying to replace few tokens from one resource bundle (.messages file) to another one using the below ant's filterchain and replacetoken.
<copy file="dev.properties" tofile="messages.properties"> <filterchain> <replaceregex pattern="\$\{" replace="{" /> <filterreader classname="org.apache.tools.ant.filters.ReplaceTokens"> <param type="propertiesfile" value="properties.txt"/> <param type="tokenchar" name="begintoken" value="{"/> <param type="tokenchar" name="endtoken" value="}"/> </filterreader> </filterchain> </copy> The target runs fine but nothing gets copied. Here are my files.
dev.properties
server.name=myServerName server.ip=127.0.0.1 messages.properties
SERVER_NAME="@server.name@" SERVER_IP="@server.ip@" Please note that messages.properties is what gets deployed to the server. It has other entries which are common to all the environments. I am using Jenkins to deploy the projects to diff environments. My plan is call this ANT target/task as a post deployment step, replace the environment/server specific variables as port, name etc in messages.properties and then do the build to app server using Jenkins.