ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lin, David" <>
Subject Calling target from within another target
Date Sun, 30 Jul 2000 22:11:14 GMT

How can I call a target from within another target.

I would like to set up an ant build file that defines several targets. Each
of these targets (such as task1 and task2) below set intial parameters and
then run a basetask. I do not think depends is sufficient because I need to
set the property BEFORE the dependent task is called.

I currently have something working, but I need to define the initial
parameter on the command line -DSomeKeyParam="xyz". 

Is there someway to call the target from within another target to accomplish
what I want?

<target name="task1">
   <property name="SomeKeyParam" value="t1">
   <call to basetask>

<target name="task2">
   <propertu name="SomeKeyParam" value="t2"> 
   <call to basetask>

<target name="basetask">
   <do something based on "SomeKeyParam">

Thanks alot,
Dave Lin

View raw message