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:00:33 GMT
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.

Thanks
Mick

On 11/12/07, glenn opdycke-hansen <glennoph@gmail.com> wrote:
>
> Could you post the complete Ant script?
> How are you invoking the script and the target(s)?
>
> I noticed if you invoke ant with both targetA and targetB, then targetA
> would be called multiple times.
>
> However if you invoke ant with targetC (below) then targetA is invoked
> once.
>
> <target name="targetC" depends="targetA, targetB">
> <echo>in targetC</echo>
> </target>
>
> --glenn
>
> On Nov 12, 2007 11:32 AM, 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
> >
> >
>

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