ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Weintraub" <qazw...@gmail.com>
Subject Re: Hi, Ant dev, I have questiones on multiple run Target
Date Thu, 27 Dec 2007 22:25:03 GMT
Dependencies are simply dependencies and are not explicit directions
on what order to do a build in.  When ant executes, it builds a
dependency tree and then steps through that tree building the earliest
dependencies first. There are times when dependencies may be built out
of order the way they are listed. For example:

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

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

<target name="target3"/>

If I say "ant target1", the first item to be built will be "target3"
even though "target2" is listed first.

What is happening is that Ant is building a dependency matrix, and
calculates out that target "aaaa" and "bbbb" have to be built before
target "all". So, it builds those two targets. It could have just as
easily built "bbbb" before "aaaa" since neither has any dependency on
the other.

I am actually surprised you didn't get an error message that you have
the same dependency listed multiple times.

If you MUST specify a build order (and if you do, you're probably
missing something. The whole concept of Ant is that Ant should be
calculating out your build order and not you), you need to do
<antcall>.

On Dec 25, 2007 3:48 AM, Vincent Li <vincent.li@starcite.com> wrote:
> Hi Ant dev,
>
>
>
> I found Ant can't run a target multiple times, a small example is
> followed, could you please hint me how to make it work??
>
>
>
> Source Code:
>
> <project name="11" default="all" basedir=".">
>
>       <target name="all" depends="aaaa, bbbb, aaaa, bbbb" />
>
>
>
>       <target name="aaaa">
>
>             <echo message="aaaaa" />
>
>       </target>
>
>
>
>       <target name="bbbb">
>
>             <echo message="bbbbb" />
>
>       </target>
>
> </project>
>
>
>
> Output:
>
>       Buildfile: D:\test.xml
>
> aaaa:
>
>      [echo] aaaaa
>
> bbbb:
>
>      [echo] bbbbb
>
> all:
>
> BUILD SUCCESSFUL
>
> Total time: 234 milliseconds
>
>
>
> What I am expecting is that both "aaaaa" and "bbbbb" should shown twice,
> how can I achieve this?
>
> Looking forward for your reply,
>
>
>
>
>
>
>
> Thanks
>
> Vincent
>
>
>
>



-- 
--
David Weintraub
qazwart@gmail.com

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


Mime
View raw message