You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Andrew Zeon <An...@hothouse.com.au> on 2003/04/02 06:33:49 UTC

When is it appropriate to use antcall?

In "Java development with Ant" by Erik Hatcher and Steve Loughran it says
excessive use to antcall is the wrong way to use ant. It has an example of
using the antcall task, but I don't quite understand when it is appropriate
to use antcall. Can somebody explain?

Thanks.

Re: When is it appropriate to use antcall?

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
On Wed, 2 Apr 2003 02:33 pm, Andrew Zeon wrote:
> In "Java development with Ant" by Erik Hatcher and Steve Loughran it says
> excessive use to antcall is the wrong way to use ant. It has an example of
> using the antcall task, but I don't quite understand when it is appropriate
> to use antcall. Can somebody explain?
>
> Thanks.

You should not use <antcall> in place of proper dependency definition. For 
example, this arrangement

<target name="build">
  <antcall target="step1"/>
  <antcall target="step2"/>
  <antcall target="step3"/>
</target>

is more simply expressed as

<target name="build" depends="step1, step2, step3">

The latter is also more maintainable as dependencies change. The first version 
is an attempt to "program" in Ant and is pretty messy.

You generally use antcall where you need to parameterize parts of your build. 
When you use <antcall> is sets up a separate context with its own property 
values. Setting properties in <antcall> does not,. therefore, set properties 
in the main build context.

-- 
Conor MacNeill
Blog: http://codefeed.com/blog/