ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Extracting application version from Java file
Date Tue, 20 Sep 2005 16:40:27 GMT
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 


Nicolas Vervelle <> 
09/20/2005 11:23 AM
Please respond to
"Ant Users List" <>


Extracting application version from Java file


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,

To unsubscribe, e-mail:
For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message