ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From KC Baltz <KBa...@responsenetworks.com>
Subject RE: setting properties from a User defined Task.
Date Mon, 07 Aug 2000 14:58:44 GMT
Thanks, that's it.  It doesn't even have an execute method.  I think I based
it on Property.java .  

K.C.

> -----Original Message-----
> From: Stefan Bodewig [mailto:bodewig@bost.de]
> Sent: Monday, August 07, 2000 9:35 AM
> To: ant-user@jakarta.apache.org
> Subject: Re: setting properties from a User defined Task.
> 
> 
> 
> >>>>> "KB" == KC Baltz <KBaltz@responsenetworks.com> writes:
> 
>  KB>   <target name="init">
>  KB>     <!-- Adds all the jars in a given directory to the 
> target property -->
>  KB>     <getjars target_property="jarClassPath"
>  KB>              basedir="${srcdir}\com\responsenetworks\lib" />
>  KB>     <!-- Set the ClassPath using some hard coded values 
> and the property we just set. -->
>  KB>     <property name="ClassPath"
>  KB> 
> value="d:\jdk1.3\jre\lib\rt.jar;d:\jdk1.3\jre\lib\jaws.jar;${j
> arClassPath}"
>  KB> />
>  KB>     <!-- The following prints ClassPath with the 
> dynamically generated
>  KB>          jarClassPath appended -->
>  KB>     <echo message="classpath = ${ClassPath}" /> 
>  KB>   </target>
> 
>  KB> The getjars task is the one that uses project.setProperty.  But
>  KB> by what you've been saying, it should be evaluated after any
>  KB> calls to <property> and thus the echo should produce:
> 
> Task.init() will be called at parser time - even if the target is
> never going to be executed.
> 
> Task.execute() will be called, when you'd expect your task to run.
> 
> I guess, your getjars task is doing its work in the init method not in
> execute. This means that (1) getjars will be called every 
> time you run Ant
> on this project, even for targets that don't depend on the init
> target and (2) you get your properties inserted into the 
> project before the
> parser gets to the ${} in the echo task. 
> 
> Your <getjars> simply works like <property> right now, with two
> exceptions: <getjars> cannot be put at the same level as targets and
> you are able to modify existing properties using <getjars>.
> 
> Hope that make things clearer.
> 
> Stefan
> 

Mime
View raw message