ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From RPea...@360commerce.com
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 
destfile="Jmol.${version}.jar">...</jar>

Robert





Nicolas Vervelle <nicolas.vervelle@steria.com> 
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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org



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