--- David Rosenstein <[EMAIL PROTECTED]> wrote: > 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 target dependency evaluation rules go out the window when you use <antcall>. I can't see any reason why you are using <antcall> here anyway. Your structure is just not set up in "the Ant way." Disregarding some of your echo logging, redundant if you use the default logger, this would rightly be: <project name="Test" default="get"> <target name="init"> <echo message="init called" /> </target> <target name="getAgain" depends="init,getThird" /> <target name="getThird" depends="init"> <echo message="getThird" /> </target> <target name="get" depends="init,getAgain" /> </project> Obviously this was a contrived example to begin with; feel free to post something closer to a "real build" if you need help grasping the "Ant way." HTH, Matt > > > Thanks for your help, > > -Dave > > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]