ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conor MacNeill <co...@cortexebusiness.com.au>
Subject Re: [PATCH] Definer to allow types/tasks from the same jar to work
Date Thu, 23 May 2002 22:40:29 GMT
costinm@covalent.net wrote:
> This patch is essential for me ( in jakarta-tomcat-connectors project, I 
> suspect other jakarta projects are affected as well ). I'm willing to make 
> changes - but I need this functionality in ant1.5 in a form or another.
> For a use-case, look at the cpp-tasks on sourceforge or any other 
> user-tasks that uses both types and tasks.
> 

I guess Magesh needs to make a call on whether this should go into the release.


> In ant1.4, this only works if the code is in the CLASSPATH ( or 
> ant/lib ). It is possible to load multiple tasks that will work togheter,
> or multiple types - but it is not possible to have the tasks ant types.
> This is because different class loaders are used. A <taskdef> can load
> multiple tasks with the same loader if file or resource attribute is 
> used. 
> 
> With this fix, we allow the user to specify that he wants different
> <taskdefs> and <typedefs> to use the same classloader instance, so the
> tasks/types can use each other. It is backward and forward compatible - 
> unless the user explicitely specify he wants the new behavior, the
> old behavior will be used with absolutely no change.
> 
> It is possible to use the same build.xml with both ant1.4 and ant1.5,
> as long as in 1.4 you put the .jar in ant/lib ( that's the
> only solution in 1.4 to solve this problem ). Asking for loader reuse
> can also be done with an explicit attribute.
> 
> Costin
> 

Costin,

Why not create a datatype for the loader

<loader id="tomcat.loader">
   <classpath ...
</loader>

and then ref in the taskdef/typedefs

<taskdef>
    <loader refid="tomcat.loader"/>
</taskdef>

No need for magic properties or implicit sharing of loaders.

Conor



--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message