ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guru Balse <guru.ba...@oracle.com>
Subject Re: Getting around Set Property Values
Date Fri, 31 Aug 2007 21:23:51 GMT
You can also consider passing in the destdir as an optional parameter 
(attribute) of the macro (with default value = ${@{module}-destdir})

David Weintraub wrote:
> Apparently, there are two methods:
>
> 1). Add the parameter name to my property name. Like this:
>
> <property name="@{module}-destdir" value="..."/>
>
> <javac srcdir="..."
>    destdir=${@{module}-destdir}"/>
>
> 2). Use the Ant Contrib variables:
>
> <var name="v.destdir" value="..."/>
> <javac srcdir="..."
>    destdir="${v.destdir}"/>
>
> 2a). Use the Ant Contrib var package, but to only reset the property:
>
> <var name="destdir" unset="true">
> <property name="destdir" value="..."/>
>
> <javac srcdir="..."
>     destdir=${destdir}/>
>
> Although it would get me out of using the AntContrib library, I
> decided against prepending the module name parameter in front of my
> property name. I already have enough issues trying to track my curly
> braces, and I'm not too sure how easy it would be for someone to
> figure out what I am doing, so I decided to go ahead with method 2.
>
> 2a. was something I was thinking of, but if I am going to be using the
> <var> task, I might as well simply set the property using <var>. To
> show a difference between variables and regular properties, I'm
> prepending my variables with a "v." This way, I know that normal
> properties don't change, but that vars (which begin with a "v." may
> change in value.
>
> There were several things that made me decide to use the AntContrib
> task. Most people here are on very old versions of Ant (one guy has
> Ant 6.0 Alpha), so they'll have to reinstall Ant anyway. So, I created
> an install package of Ant 1.7 with the AntContrib tasks already built
> in. Since I was teetering on edge of using the AntContrib package (the
> <if> and <outofdate> tasks looked very helpful), this issue made me
> decide to go ahead and require it.
>
> Thanks for your help.
>
> ---------------------------------------------------------------------
> 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