I have a file called versionInfo.txt. This file among other things has the following text: "Implementation-Version: 7.5.0.1".
I need to retrieve the version value and copy this version value to a Java file. The Java file will have the following variable:
version = "@version-info@";
I need to replace this @version-info@ with the value I retrieved from the first file. I need to do plug in this code in an existing build.xml file written using ant script.
For the second part of your question, retrieve the version info.. : If you need to read the Implementation-Version from the Manifest of a jar you may use a macrodef, f.e. :
Create a properties file like this and name it build.properties
Then in your build.xml file
So your file structure should look like
Then you can execute your ANT build by changing to the "myproject" directory and executing
The
replace
tag will look for the string "@version-info@" in your myClass.java file and replace it with the value "7.5.0.1"