ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Scokart <gscok...@gmail.com>
Subject Re: For every usage of Ant class api, different class loader
Date Sat, 07 Nov 2009 13:09:47 GMT
An other aproach is to specify a loader id when declaring the tasks in the
parent project (and make sure your inherit this id in the subclass).


Gilles Scokart


2009/11/5 Stefan Bodewig <bodewig@apache.org>

> On 2009-11-05, Raja Nagendra Kumar <Nagendra.Raja@tejasoft.com> wrote:
>
> > When we are using Ant.java/class api Is it possible to explicitly set the
> > new class loader, even if the initial classes existed in system
> classloader(
> > i.e though classpath or in ant lib directory.)
> >
> > The issue we are seeing is when we load our custom tasks though taskdef,
> new
> > classloader is being used for every programmatic ant call there fore
> static
> > blocks are reinitialised for every sub ant project, however when  when we
> > put it in lib or in system classpath, distinct classloader is not
> > used..hence we have issue with some static code :) not being
> reinitialized.
>
> Don't use static blocks 8-)
>
> Alternatively, don't make your jars available in the system classloader
> or use the (deprecated) reverseloader attribute of taskdef.
>
> > Once we understand classloder  behaviors in ant based on project vs
> > subproject and TaskDef classpath way and systemclasspath way, then we
> could
> > be more confident to fix the current issue.
>
> It doesn't have any real relation to subprojects at all.  Ant normally
> delegates loading of any classes up the classloader chain.
>
> Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>

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