Query regarding antcall task

View: New views
3 Messages — Rating Filter:   Alert me  

Query regarding antcall task

by Vishal Kamat :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
I came to know that with antcall task, the dependencies get executed even
though it ran before. For example below, the target "B" gets executed 3
times (ideally it should only once). Is there a way to handle this? Your
help will be much appreciated

<project name="test" basedir="." default="A">
        <target name="A">
                <antcall target="buildJar">
                        <param name="build.dir" value="tools"/>

                </antcall>
                <antcall target="buildJar">
                        <param name="build.dir" value="moduleA"/>
                </antcall>

                <antcall target="buildJar">
                        <param name="build.dir" value="moduleB"/>
                </antcall>
        </target>


        <target name="buildJar" depends="B">
                <echo> Inside buildJar: ${build.dir}</echo>
        </target>

        <target name="B">

                <echo>Inside dependency B</echo>
        </target>

</project>

Re: Query regarding antcall task

by Stefan Bodewig :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Vishal,

this sort of question should better be asked on the user list.

On Wed, 26 Mar 2008, Vishal Kamat <vishalkamat@...> wrote:

> Hi, I came to know that with antcall task, the dependencies get
> executed even though it ran before.

True.  Think of <antcall> as starting a new instance of Ant on your
build file that doesn't have any idea of which targets have already
been executed in your current instance of Ant.

> For example below, the target "B" gets executed 3 times (ideally it
> should only once). Is there a way to handle this?

Don't use <antcall>, in your example <macrodef> what buildJar does and
use that.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: Query regarding antcall task

by Vishal Kamat :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks a lot Stefan. Will use the user list from now on.

Vishal

On Wed, Mar 26, 2008 at 10:04 PM, Stefan Bodewig <bodewig@...> wrote:

> Hi Vishal,
>
> this sort of question should better be asked on the user list.
>
> On Wed, 26 Mar 2008, Vishal Kamat <vishalkamat@...> wrote:
>
> > Hi, I came to know that with antcall task, the dependencies get
> > executed even though it ran before.
>
> True.  Think of <antcall> as starting a new instance of Ant on your
> build file that doesn't have any idea of which targets have already
> been executed in your current instance of Ant.
>
> > For example below, the target "B" gets executed 3 times (ideally it
> > should only once). Is there a way to handle this?
>
> Don't use <antcall>, in your example <macrodef> what buildJar does and
> use that.
>
> Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@...
> For additional commands, e-mail: dev-help@...
>
>