David Weintraub wrote:
If you invoke multiple targets on the command line, each target will
execute, and dependencies will execute independently. There is no way
of Ant to know if one of the targets you put on the command line might
affect a later target. For example:
$ ant first clean_first second
If Ant kept track of targets already executed, it would be messed up
by the "clean_first" target. Target "second" depends upon "first", but
"clean_first" destroyed what files "first" had built. That's why each
target will execute all of its dependencies.
However, this works fine:
<project name="test">
<target name="first"/>
<target name="second" depends="first"/>
<target name="third" depends="first,second"/>
</project>
Executing:
$ ant third
[first]
[second]
[third]
Executes target "first" only a single time
There is actually a way to maybe get Ant to resolve dependencies across
targets on the command line, but it isnt exposed to the end user. Inside
ant there are these things called Executors that decide which targets to
run next. The normal executor runs everything on the command line. If
you go -keepgoing, a new executor runs targets that dont depend on
targets that have failed; it 'keeps going' as well as it can. You could
probably add a new executor that took intra-target dependencies into
account, and switch to it using whichever magic property identifies the
new executor. This is pretty low level though; I don't know anyone who
has done this.
--
Steve Loughran http://www.1060.org/blogxter/publish/5
Author: Ant in Action http://antbook.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]