You're going to wrong way.

Pass into your Ant build the version number like so: ant 
-Dversion=XX.YY.ZZ clean build test.

Then use the <replace> task to replace a token in your Java file. Even 
better, you store that number in MANIFEST.MF and update it with the <jar> 
task. Or, use a properties file. That way your dev's aren't the ones that 
set the version, your build controller/cm person does.

Oh, and just grab ${version} and use it in your <jar> task like so: <jar 
destfile="Jmol.${version}.jar">...</jar>

Robert





Nicolas Vervelle <[EMAIL PROTECTED]> 
09/20/2005 11:23 AM
Please respond to
"Ant Users List" <user@ant.apache.org>


To
user@ant.apache.org
cc

Subject
Extracting application version from Java file






Hi,

In one of my Java source file, I have a line like this:
public final static String version = "XX.YY.ZZ";

I'd like to extract the XX.YY.ZZ from the Ant build to name the 
resulting jar file with it : Jmol.XX.YY.ZZ.jar

Can someone help me with how to extract the string from the file ?

Thanks in advance,
Nicolas


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to