ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "broken connection" <brokenconnect...@gmail.com>
Subject Re: Question about "depends" attribute in the target element
Date Mon, 12 Nov 2007 19:06:35 GMT
Thanks Rick,
But like Glenn specified if you add an extra target then everything works
fine, please see below:

build.xml:

<project>
    <target name="first">
        <echo message="target First" />
    </target>

    <target name="second" depends="first">
        <echo message="target Second" />
    </target>

 <target name="third" depends="first,second">
        <echo message="target Third" />
    </target>
</project>
Output:

Total time: 0 seconds
C:\Documents and Settings\hjhutty\Desktop\test>ant first second
Buildfile: build.xml

first:
     [echo] target First

first:
     [echo] target First

second:
     [echo] target Second

BUILD SUCCESSFUL
Total time: 0 seconds
C:\Documents and Settings\mick\Desktop\test>ant third
Buildfile: build.xml

first:
     [echo] target First

second:
     [echo] target Second

third:
     [echo] target Third

BUILD SUCCESSFUL
Total time: 0 seconds
And I would like to know the solution for this, how to resolve this issue
then because I thought "depends" would do it for me but as you can see i am
getting stuck...

Thanks
Mick


On 11/12/07, Rick Genter <rgenter@silverlink.com> wrote:
>
> > From: broken connection [mailto:brokenconnection@gmail.com]
> > Sent: Monday, November 12, 2007 11:01 AM
> > To: Ant Users List
> > Subject: Re: Question about "depends" attribute in the target element
> >
> > Thanks Glenn,
> > Here's a small test script that i wrote that simulates my
> > environment and
> > proves my findings:
> >
> > build.xml:
> > <project>
> >     <target name="first">
> >         <echo message="target First" />
> >     </target>
> >
> >     <target name="second" depends="first">
> >         <echo message="target Second" />
> >     </target>
> > </project>
> > Output:
> >
> > C:\Documents and Settings\mick\Desktop\test>ant first second
> > Buildfile: build.xml
> >
> > first:
> >      [echo] target First
> >
> > first:
> >      [echo] target First
> >
> > second:
> >      [echo] target Second
> >
> > BUILD SUCCESSFUL
> > Total time: 0 seconds
> > C:\Documents and Settings\hjhutty\Desktop\test>
> >
> > It clearly shows that the first target is run multiple
> > times.Can someone
> > please correct my understanding as to why this is happening.
>
> Ant targets specified on the command line are invoked independently;
> it's as if you specified "ant first ; ant second", with the caveat that
> any properties defined during the execution of the first target will
> still be defined when the second target is executed.
> --
> Rick Genter
> Principal Software Engineer
> Silverlink Communications
> rgenter@silverlink.com
> www.silverlink.com
> Office (781) 425-5763
> Mobile (781) 771-9677
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message