ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: Getting Ant property from Java class
Date Wed, 25 Jul 2007 22:26:58 GMT

--- Chris <shef31@yahoo.com> wrote:

> How do I set a property equal to a value obtained
> from a Java class?
> 
> For example, in our app we define the version in a
> constant:
> 
> class MyClass {
>      static public final String VERSION = "1.0";
> }
> 
> In build.xml, I'd like to assign a version property:
> 
> <property
>      name="my_version"
>      value="(somehow get this from MyClass.VERSION)"
> />
> 
> 
> and then use it to, say, name the .jar file:
> 
> <jar destfile="/mydir/myapp-${my_version}.jar">
>      <fileset etc...>
> </jar>
> 

See
http://ant.apache.org/manual/CoreTypes/filterchain.html#classconstants
; note that you will need the Jakarta bcel library.

HTH,
Matt

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



      ____________________________________________________________________________________
Luggage? GPS? Comic books? 
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz

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


Mime
View raw message