ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Weintraub" <qazw...@gmail.com>
Subject Re: Question about "depends" attribute in the target element
Date Mon, 12 Nov 2007 20:23:46 GMT
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

On Nov 12, 2007 12:32 PM, broken connection <brokenconnection@gmail.com> wrote:
> Hi Friends,
> As far as I knew, if we have "depends" in the target then that target
> would run only once. But my target is running multiple times.
>
> For example, I have this:
>
> <target name="targetA">
> </target>
>
> <target name="targetB" depends="targetA">
> </target>
>
> The execution results as:
> targetA
> targetA
> targetB
>
> But I thought since "targetA" has already been executed it should show up as:
>
> targetA
> targetB
>
> And only if targetA has not been executed before, then "targetB"
> should execute "targetA" i.e again the same output
>
> targetA
> targetB
>
> Please help me guys as to where my understanding is wrong.
>
> Thanks
> Mick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>



-- 
--
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