Ant guarantees that a dependency executes once per project, not necessarily once per run. When you use <ant> or <antcall>, you start a new project with each call. This is why the init target gets executed again - once in each new project you start.
Vladimir -----Original Message----- From: Stephen McConnell [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 22, 2006 9:07 AM To: 'Ant Users List' Subject: RE: question about dependencies > -----Original Message----- > From: David Rosenstein [mailto:[EMAIL PROTECTED] > Sent: Thursday, 23 February 2006 2:33 AM > To: [email protected] > Subject: question about dependencies > > Hi All- > Sorry about the double post. The rest of my question is here now. > > I've seen a couple of rumblings in the archives on this, but > I am really confused about the ant documentation versus > actual behavior on target dependencies. The documentation ( > <http://ant.apache.org/manual/using.html#targets> > http://ant.apache.org/manual/using.html#targets) seems to > imply that once a target dependency is executed it will never > be executed again as a dependency. But if i run this script here: > > <?xml version="1.0"?> > <project name="Test" default="get"> > <target name="init"> > <echo message="init called" /> > </target> > <target name="getAgain" depends="init"> > <echo message="getAgain called" /> > <antcall target="getThird" /> > </target> > <target name="getThird" depends="init"> > <echo message="getThird" /> > </target> > <target name="get" depends="init"> > <antcall target="getAgain" /> > </target> > </project> > > > The output I get is: > > C:\Build>ant\bin\ant > Buildfile: build.xml > > init: > [echo] init called > > get: > > init: > [echo] init called > > getAgain: > [echo] getAgain called > > init: > [echo] init called > > getThird: > [echo] getThird > > BUILD SUCCESSFUL > Total time: 1 second > > > > After reading the documentation it seems that init should > only be called once though. Why is it being called so many times? The culprit is your <antcall> statements. If you restructured your build such that you don't use antcall the duplication will disappear. /Steve. -------------------------- Stephen McConnell mailto:[EMAIL PROTECTED] http://www.dpml.net --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _______________________________________________________________________ Notice: This email message, together with any attachments, may contain information of BEA Systems, Inc., its subsidiaries and affiliated entities, that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
