ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Cepek" <>
Subject RE: target dependencies
Date Wed, 18 May 2005 13:06:00 GMT
Ah, I see.  The key point is that invoking a series of targets from the
command line:

  $ ant clean-all build-all

doesn't work the same as:

  <target name="clean-and-build-all" depends="clean-all, build-all">

That's fine.  I wasn't suggesting that Ant be changed.  It's just
confusing and perhaps should be clarified in the manual.

I have also noticed that targets invoked using the <antcall> and <ant>
tasks have this "command-line target behavior" as well.  This can be
even more confusing to an Ant script writer, since (particularly with
<antcall>) the subordinate task seems like it is being called in the
context of other executing targets.

This "command-line target behavior" is easily explained by pointing out
its equivalence to typing:

  $ ant clean-all
  $ ant build-all

This explanation easily extends to the <ant> task too.

The <antcall> task, however, seems like a much more likely candidate to
''play well with <target depends="">''.  Has anyone ever suggested some
mechanism to enable this?  Perhaps a command-line option for Ant, or an
attribute to <antcall> (and maybe <ant> as well)?

As things are, any use of <antcall> causes additional calls to dependent
targets which usually don't need to be executed again.

----- Conor MacNeill wrote:

Michael Cepek wrote:
> This doesn't seem right to me.

Well, right or wrong, that is the way Ant has worked since the start and
it will not be changed now. The paragraph you are quoting is about the
dependencies in a single Ant target evaluation. So if Laurie had a

<target name="target3" depends="target1, target2"/>

and he executes

ant target3

then init will only be run once. IOW,

ant target1 target2

is not the same beast. It says evaluate target1 and then evaluate

There are probably arguments for both behaviours. With Ant, you can do
something like this

ant build clean

and be sure the clean is the last target evaluated even if build or one
of its dependencies depends on "clean"

> The "Using Ant" chapter of the "Ant User Manual" has always seemed 
> pretty clear on the subject:
>    "In a chain of dependencies stretching back from
>     a given target [...] each target gets executed
>     only once, even when more than one target
>     depends on it."
> See text paragraph five of:
> So shouldn't Laurie's "init" target only be executed once (without 
> having to fiddle with mysterious undocumented Ant settings)?!?!?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message