ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Barry White <bwh...@fotango.com>
Subject Re: Extracting application version from Java file
Date Tue, 20 Sep 2005 16:43:12 GMT
Hi Nicolas,

how about controlling the version number in the build?

   <property name="version" value="XX.YY.ZZ"/>

then update the version in the source file on every build:

   <replaceregexp file="${source}/some/package/Class.java">
     <regexp pattern="public final static String version = (.*)" />
     <substitution expression='public final static String version = 
"${version}";' />
   </replaceregexp>

and then compile and use ${version} to name the jar?

Barry

Nicolas Vervelle wrote:
> 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
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message