You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Laurie Harper <la...@holoweb.net> on 2005/05/07 05:41:17 UTC

target dependencies

It's been a while since I've written an Ant build file, so I may be 
missing something obvious here... can anyone shine a light for me? I 
have targets that have common dependencies and if I try to run them in a 
single invocation Ant executes the common dependency repeatedly.

Here's an example:

$ cat build.xml
<project default="target2">
         <target name="init">
                 <echo message="init"/>
     </target>

         <target name="target1" depends="init">
         <echo message="target1"/>
         </target>

         <target name="target2" depends="init">
         <echo message="target2"/>
         </target>
</project>

$ ant target1 target2
Buildfile: build.xml

init:
      [echo] init

target1:
      [echo] target1

init:
      [echo] init

target2:
      [echo] target2

BUILD SUCCESSFUL
Total time: 1 second
$


I was only expecting 'init' to be run once... that's the way I remember 
things working. Am I doing something wrong, or is Ant?

Thanks,

L.


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


Re: target dependencies

Posted by Mark Lundquist <ml...@comcast.net>.
On May 6, 2005, at 8:41 PM, Laurie Harper wrote:

> I was only expecting 'init' to be run once... that's the way I 
> remember things working. Am I doing something wrong, or is Ant?

You're not doing anything wrong... you're just remembering wrong :-)

The way it's working is the way it works.

cheers,
—ml—


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