I am trying to replace the version number in the build.xml file with an ANT script.
I tried various approaches, searched and re-searched StackOverflow for answers, but couldn't get the exact request.
so here is my xml file:
<?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.0"?> <project name="feature" default="main" basedir="."> <target name="init"> <property name="Version" value="1.0.0.20120327"/> </target> <target name="main" depends="init"> <description>Main target</description> </target> </project>
Now that you can see that the version has yesterday's date. I need to replace it with the current date.
Here is what I tried:
<target name="replace"> <tstamp > <format property="touch.time" pattern="yyyyMMdd"/> </tstamp> <property name="Feature.dir" location="../feature" /> <copy file="${Feature.dir}\build.xml" tofile="${Feature.dir}\build1.xml" filtering="yes" overwrite="yes"> <filterset> <filter token="Version" value="1.0.0.${touch.time}"/> </filterset> </copy> </target>
sloggers1894
source share