You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Guy Catz <Gu...@waves.com> on 2008/06/16 09:50:15 UTC
Depends="init" problem
I have several targets, all depends on init -
<target name="a" depends="init">
...
<target name="b" depends="init">
...
<target name="c" depends="init">
...
and of course <target name="init">
...
Now, I also have a target which call a, then b and then c.
But when I run that ANT, the output is something like this -
running <init> - successful
running <a> - successful
running <init> - successful
running <b> - successful
running <init> - successful
running <c> - successful
which means that Init ran 3 times!! instead of only once.
I do I make it to run only once?
Please advise.
Thanks,
Guy.
RE: Depends="init" problem
Posted by Shawn Castrianni <Sh...@halliburton.com>.
There are many ways to call ant targets. If you stick with using the depends to get a target called, then ant will never duplicate a target. So to get a target to call a then b then c but only run init once, just make this new "big" target depend on a,b,c and it will call each of them in order first before big which will even before that first call init only one time.
<target name="big" depends="a,b,c"/>
So you should see:
<init>
<a>
<b>
<c>
<big>
---
Shawn Castrianni
-----Original Message-----
From: Guy Catz [mailto:Guy.catz@waves.com]
Sent: Monday, June 16, 2008 2:50 AM
To: user@ant.apache.org
Subject: Depends="init" problem
I have several targets, all depends on init -
<target name="a" depends="init">
...
<target name="b" depends="init">
...
<target name="c" depends="init">
...
and of course <target name="init">
...
Now, I also have a target which call a, then b and then c.
But when I run that ANT, the output is something like this -
running <init> - successful
running <a> - successful
running <init> - successful
running <b> - successful
running <init> - successful
running <c> - successful
which means that Init ran 3 times!! instead of only once.
I do I make it to run only once?
Please advise.
Thanks,
Guy.
----------------------------------------------------------------------
This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Depends="init" problem
Posted by Chris Green <ch...@googlemail.com>.
I use something like :-
<target name="all" depends="init, a, b, c" description="Initialise, a,
b,c">
</target>
and then have the four targets init, a, b and c doing whatever.
Regards
Chris
On Mon, Jun 16, 2008 at 9:50 AM, Guy Catz <Gu...@waves.com> wrote:
> I have several targets, all depends on init -
>
> <target name="a" depends="init">
> ...
>
> <target name="b" depends="init">
> ...
>
> <target name="c" depends="init">
> ...
>
> and of course <target name="init">
> ...
>
>
> Now, I also have a target which call a, then b and then c.
> But when I run that ANT, the output is something like this -
> running <init> - successful
> running <a> - successful
> running <init> - successful
> running <b> - successful
> running <init> - successful
> running <c> - successful
>
> which means that Init ran 3 times!! instead of only once.
>
> I do I make it to run only once?
>
> Please advise.
>
> Thanks,
> Guy.
>
Re: Depends="init" problem
Posted by Sandeep Kumar K <sa...@genevasoftech.com>.
That is because your tasks a,b,c are depending on Task "init"
That means before executing target a, target "init" will be executed.
same for Target b & c.
Thats why init will be executed thrice.
Thanks & Regards
Sandeep Kumar K
Sr. Software Engineer
Geneva Software Technologies Limited,
# 82, Research Center II, I floor, EPIPA
Nallurhalli, Whitefield, Bangalore - 560066
Mob : +91-9880193454
Guy Catz wrote:
> I have several targets, all depends on init -
>
> <target name="a" depends="init">
> ...
>
> <target name="b" depends="init">
> ...
>
> <target name="c" depends="init">
> ...
>
> and of course <target name="init">
> ...
>
>
> Now, I also have a target which call a, then b and then c.
> But when I run that ANT, the output is something like this -
> running <init> - successful
> running <a> - successful
> running <init> - successful
> running <b> - successful
> running <init> - successful
> running <c> - successful
>
> which means that Init ran 3 times!! instead of only once.
>
> I do I make it to run only once?
>
> Please advise.
>
> Thanks,
> Guy.
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Depends="init" problem
Posted by Vijay Aravamudhan <av...@gmail.com>.
hi,
I think the way you invoke the targets is like:
ant -f buildFile.xml a b c
If that is the case, you are invoking each target independent of each
other - which means that the dependencies for each are discovered
separately and executed - once for a, once for b and once for c. If you
had a single target called 'all' or something that ties together a, b
and c, and you invoke that from the command line, then the dependency
tree will be determined once and init will be called once for each
invocation.
Does that make sense?
hth,
Vijay
Guy Catz wrote:
> I have several targets, all depends on init -
>
> <target name="a" depends="init">
> ...
>
> <target name="b" depends="init">
> ...
>
> <target name="c" depends="init">
> ...
>
> and of course<target name="init">
> ...
>
>
> Now, I also have a target which call a, then b and then c.
> But when I run that ANT, the output is something like this -
> running<init> - successful
> running<a> - successful
> running<init> - successful
> running<b> - successful
> running<init> - successful
> running<c> - successful
>
> which means that Init ran 3 times!! instead of only once.
>
> I do I make it to run only once?
>
> Please advise.
>
> Thanks,
> Guy.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Depends="init" problem
Posted by Peter Reilly <pe...@gmail.com>.
each <antcall> creates a new project, targets in each project
are independent of targets with the same name in other projects.
Peter
On Mon, Jun 16, 2008 at 9:00 AM, Bourzeix, Hervé
<He...@genesys.com> wrote:
> You may have antcall in your code. Antcall don't pay attention to the depends list.
>
> regards,
>
> -----Original Message-----
> From: Guy Catz [mailto:Guy.catz@waves.com]
> Sent: Monday, June 16, 2008 9:50 AM
> To: user@ant.apache.org
> Subject: Depends="init" problem
>
> I have several targets, all depends on init -
>
> <target name="a" depends="init">
> ...
>
> <target name="b" depends="init">
> ...
>
> <target name="c" depends="init">
> ...
>
> and of course <target name="init">
> ...
>
>
> Now, I also have a target which call a, then b and then c.
> But when I run that ANT, the output is something like this -
> running <init> - successful
> running <a> - successful
> running <init> - successful
> running <b> - successful
> running <init> - successful
> running <c> - successful
>
> which means that Init ran 3 times!! instead of only once.
>
> I do I make it to run only once?
>
> Please advise.
>
> Thanks,
> Guy.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
RE: Depends="init" problem
Posted by Bourzeix,
Hervé <He...@Genesys.com>.
You may have antcall in your code. Antcall don't pay attention to the depends list.
regards,
-----Original Message-----
From: Guy Catz [mailto:Guy.catz@waves.com]
Sent: Monday, June 16, 2008 9:50 AM
To: user@ant.apache.org
Subject: Depends="init" problem
I have several targets, all depends on init -
<target name="a" depends="init">
...
<target name="b" depends="init">
...
<target name="c" depends="init">
...
and of course <target name="init">
...
Now, I also have a target which call a, then b and then c.
But when I run that ANT, the output is something like this -
running <init> - successful
running <a> - successful
running <init> - successful
running <b> - successful
running <init> - successful
running <c> - successful
which means that Init ran 3 times!! instead of only once.
I do I make it to run only once?
Please advise.
Thanks,
Guy.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org