You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Shailesh Sharma <sh...@yahoo.com> on 2004/02/05 15:57:07 UTC

how to run a target multiple times from another target

Hi, I have a build.xml file that contains a target called "deploy" that i need to execute 5 times depending upon the source specified in another target called "deploy-cm-testnet". So on my command line i will just type >ant deploy-cm-testnet
 
and it will execute the "deploy" target 5 times .....all i want to know is if it will work OR if it is the correct approach .....???  
 
Well what i mean to say is ......i probably want to write a target that does the deploy, and then call the target many times. 

ie. something like this 
<target name="deploy"> <wldeploy source="${source}" /> 
</target>
 
 
 
<target name="deploy-cm-testnet"> 

<antcall target="deploy"> <param name="source" value="foo1.war"/> </antcall> 

<antcall target="deploy"> <param name="source" value="foo2.war"/> </antcall> 

<antcall target="deploy"> <param name="source" value="foo3.war"/> </antcall> 

<antcall target="deploy"> <param name="source" value="foo4.war"/> </antcall> 

<antcall target="deploy"> <param name="source" value="foo5.war"/> </antcall> 

</target> 
 
Please suggest.

 
 

---------------------------------
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online

Re: how to run a target multiple times from another target

Posted by Matt Benson <gu...@yahoo.com>.
--- Shailesh Sharma <sh...@yahoo.com> wrote:
> Well what i mean to say is ......i probably want to
> write a target that does the deploy, and then call
> the target many times. 

That certainly is a way to do it.  There might be
others using dependencies, etc., but it would all
amount to pretty much the same thing.  You might look
at ant-contrib since they have several alternatives to
<antcall> including the terse <foreach> and <for>
which handle looping over (in your case) a <fileset>. 
The online documentation is not up to date (notably,
<for> is absent) but the latest release contains the
current docs.

-Matt

__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

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