ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter reilly <peter.rei...@corvil.com>
Subject Re: Using classloader for Junit
Date Fri, 20 Jun 2003 18:13:11 GMT
On Fri, 2003-06-20 at 06:23, Costin Manolache wrote:
> Nick Chalko wrote:
> 
> > After I slept on it,  I thought of how I could extend the antclassloader
> > to handle the situations I need.
> > I am considering a <antlibclassloader />
> > That will explicitly allow the optional ant task to be loaded in the
> > child classloader.
> > I may even go so far as  automatically adding this fileset
> > ${ant.home}/lib/ant-*.jar   to the classloader.
> > 
> > That should handle the usecase I have in mind.
> 
> Are you talking about a single child loader for all optional tasks ?
> This may work - if you use normal delegation. The code that instantiate
> the tasks needs to have a reference to the child loader, and I don't
> think core tasks have dependencies on the classes in the optional.
> 
> > peter reilly wrote:
> > 
> >>Ah, I see.
> >>That would be nice, but the classloader task is not
> >>yet complete.

Hi Costin,
looking at classloader, it seems to imply that it can
be used at to ant's default classloader, to help in defining
tasks/types.

However when I try to do:
<project name="c">
    <mkdir dir="classes"/>
    <javac srcdir="src" destdir="classes"/>
    <classloader>
        <classpath path="classes"/>
    </classloader>
    <taskdef name="myecho" classname="org.acme.MyEcho"
classpath="classes"/>
    <myecho>hello</myecho>
    <taskdef name="myecho2" classname="org.acme.MyEcho" />
    <myecho2>hello</myecho2>
</project>

The first myecho works, but the second does not.

Peter.

> 
> The part that loads junit.jar to the main loader is complete.
> 
> There are other possible enhancements to create arbitrary loaders
> or support reloading which are not yet implemented.
> 
> Costin
> 
> 
> 
> >>
> >>Peter
> >>
> >>On Thu, 2003-06-19 at 08:52, Nick Chalko wrote:
> >>  
> >>
> >>>peter reilly wrote:
> >>>
> >>>    
> >>>
> >>>>Check the ant faq http://ant.apache.org/faq.html#delegating-classloader
> >>>>In essence you need to place the junit.jar file in ${ant.home}/lib
> >>>>
> >>>> 
> >>>>
> >>>>      
> >>>>
> >>>I had hoped that was what the <classloader/> task would let me avoid.
> >>>
> >>>
> >>>    
> >>>
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> >>For additional commands, e-mail: dev-help@ant.apache.org
> >>  
> >>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
> 
> 


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


Mime
View raw message