You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by ravi p <pa...@gmail.com> on 2007/03/20 07:53:39 UTC

Reinitializing static variables

hi ,

I have written two ant tasks, in one task I have static final List object,
also I am adding objects into this static list object, in another task, if I
want retrieve the objects from the static list, it is giving zero results.

Any thoughts , regarding how can I share a static object between two tasks..
?

Thanks
Ravi.

Re: Reinitializing static variables

Posted by ravi p <pa...@gmail.com>.
Hi..
It is working ..
Thank you  very much.

-Ravi.


On 3/20/07, Gilles Scokart <gs...@gmail.com> wrote:
>
>
> Did you tried to define the loader (and the task) in the parent script and
> use inheritRefs="true"?
>
> I think you could also invoke the taskdef only in the parent script, use
> it
> in the child script without having to redefine the task.
>
> Gilles
>
>
> > -----Original Message-----
> > From: ravi p [mailto:pasala.ravi@gmail.com]
> > Sent: mardi 20 mars 2007 13:23
> > To: Ant Users List
> > Subject: Re: Reinitializing static variables
> >
> > Thanks you very much, it it working.
> > but I am calling  these tasks using ant task, I mean both task are in
> > different projects, if I call the task2 in the same project (the same
> > build
> > file), it is working, but I want call the task2 in calling project ..
> >
> > <target name="tasktest>
> >         <ant antfile="xTask1.xml"  />
> >         <ant antfile="yTask1.xml"  />
> >         <task2 name="task2" />
> > </target>
> >
> > so In this case, can I get the shared static data from, task1 to task2 ?
> > could you please tell me ?
> >
> > Thanks
> > Ravi
> >
> >
> >
> > On 3/20/07, Gilles Scokart <gs...@gmail.com> wrote:
> > >
> > > Make sure your tasks are defined in the same loader (an option of the
> > > taskdef task).
> > >
> > > Gilles
> > >
> > > > -----Original Message-----
> > > > From: ravi p [mailto:pasala.ravi@gmail.com]
> > > > Sent: mardi 20 mars 2007 7:54
> > > > To: user@ant.apache.org
> > > > Subject: Reinitializing static variables
> > > >
> > > > hi ,
> > > >
> > > > I have written two ant tasks, in one task I have static final List
> > > object,
> > > > also I am adding objects into this static list object, in another
> > task,
> > > if
> > > > I
> > > > want retrieve the objects from the static list, it is giving zero
> > > results.
> > > >
> > > > Any thoughts , regarding how can I share a static object between two
> > > > tasks..
> > > > ?
> > > >
> > > > Thanks
> > > > Ravi.
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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: Reinitializing static variables

Posted by Gilles Scokart <gs...@gmail.com>.
Did you tried to define the loader (and the task) in the parent script and
use inheritRefs="true"?

I think you could also invoke the taskdef only in the parent script, use it
in the child script without having to redefine the task.

Gilles


> -----Original Message-----
> From: ravi p [mailto:pasala.ravi@gmail.com]
> Sent: mardi 20 mars 2007 13:23
> To: Ant Users List
> Subject: Re: Reinitializing static variables
> 
> Thanks you very much, it it working.
> but I am calling  these tasks using ant task, I mean both task are in
> different projects, if I call the task2 in the same project (the same
> build
> file), it is working, but I want call the task2 in calling project ..
> 
> <target name="tasktest>
>         <ant antfile="xTask1.xml"  />
>         <ant antfile="yTask1.xml"  />
>         <task2 name="task2" />
> </target>
> 
> so In this case, can I get the shared static data from, task1 to task2 ?
> could you please tell me ?
> 
> Thanks
> Ravi
> 
> 
> 
> On 3/20/07, Gilles Scokart <gs...@gmail.com> wrote:
> >
> > Make sure your tasks are defined in the same loader (an option of the
> > taskdef task).
> >
> > Gilles
> >
> > > -----Original Message-----
> > > From: ravi p [mailto:pasala.ravi@gmail.com]
> > > Sent: mardi 20 mars 2007 7:54
> > > To: user@ant.apache.org
> > > Subject: Reinitializing static variables
> > >
> > > hi ,
> > >
> > > I have written two ant tasks, in one task I have static final List
> > object,
> > > also I am adding objects into this static list object, in another
> task,
> > if
> > > I
> > > want retrieve the objects from the static list, it is giving zero
> > results.
> > >
> > > Any thoughts , regarding how can I share a static object between two
> > > tasks..
> > > ?
> > >
> > > Thanks
> > > Ravi.
> >
> >
> > ---------------------------------------------------------------------
> > 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: Reinitializing static variables

Posted by ravi p <pa...@gmail.com>.
Thanks you very much, it it working.
but I am calling  these tasks using ant task, I mean both task are in
different projects, if I call the task2 in the same project (the same build
file), it is working, but I want call the task2 in calling project ..

<target name="tasktest>
        <ant antfile="xTask1.xml"  />
        <ant antfile="yTask1.xml"  />
        <task2 name="task2" />
</target>

so In this case, can I get the shared static data from, task1 to task2 ?
could you please tell me ?

Thanks
Ravi



On 3/20/07, Gilles Scokart <gs...@gmail.com> wrote:
>
> Make sure your tasks are defined in the same loader (an option of the
> taskdef task).
>
> Gilles
>
> > -----Original Message-----
> > From: ravi p [mailto:pasala.ravi@gmail.com]
> > Sent: mardi 20 mars 2007 7:54
> > To: user@ant.apache.org
> > Subject: Reinitializing static variables
> >
> > hi ,
> >
> > I have written two ant tasks, in one task I have static final List
> object,
> > also I am adding objects into this static list object, in another task,
> if
> > I
> > want retrieve the objects from the static list, it is giving zero
> results.
> >
> > Any thoughts , regarding how can I share a static object between two
> > tasks..
> > ?
> >
> > Thanks
> > Ravi.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

RE: Reinitializing static variables

Posted by Gilles Scokart <gs...@gmail.com>.
Make sure your tasks are defined in the same loader (an option of the
taskdef task).

Gilles

> -----Original Message-----
> From: ravi p [mailto:pasala.ravi@gmail.com]
> Sent: mardi 20 mars 2007 7:54
> To: user@ant.apache.org
> Subject: Reinitializing static variables
> 
> hi ,
> 
> I have written two ant tasks, in one task I have static final List object,
> also I am adding objects into this static list object, in another task, if
> I
> want retrieve the objects from the static list, it is giving zero results.
> 
> Any thoughts , regarding how can I share a static object between two
> tasks..
> ?
> 
> Thanks
> Ravi.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org