ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: For every usage of Ant class api, different class loader
Date Thu, 05 Nov 2009 05:35:05 GMT
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
View raw message