On Sat, 13 Jul 2002, Peter Donald wrote:
> At 03:01 PM 7/12/2002 -0700, you wrote:
> >Not sure I understand what will brake. I'm not talking about putting
> >ant implementation in a separate loader, like tomcat does - just
> >have a small Bootstrap that creates an AntClassLoader and puts
> >everything in lib/ in it ( like the shell is doing ).
>
> The sheel places them in the system classloader and thus a classloader like
>
> new URLClassLoader( new URL[] { myFile.toURL() } );
>
> include the ant classes (as they are in system classloader).
You realize this is wrong and such code will fail in a container
environment. ( as general programming - for ant it may be ok ).
Ok, would it be ok if the ant classes ( core, types, standard taskdefs )
are in the system loader, but the optional tasks are not ?
That's even simpler to implement - just make sure optional.jar is not
loaded by the shell, and load it as a first step in Project.init(),
in an AntClassLoader.
Are your tasks using something from optional.jar and assume it is
in the system loader ?
> >It is possible to put some jars in CLASSPATH ( like they were before )
> >if needed.
>
> The problem is that we have to place everything that currently exists in
> ant in the system classloader if we want to maintain backwards
> compatability. For future things we could create subclassloaders maybe.
For future (1.7?) I would like the 'full' separation, with the xml parser
and all the auxiliary classes in a paralel loader ( like the container
loader in tomcat ), to allow tasks to use their own jaxp parsers.
I think I can do that easily with a hook - so that ant itself will
not be modified, but if people choose to use a classloader hook (
by installing something like the ProjectHelper2 in classpath or
setting an option ) they get a 'hierarchical loader' similar
with tomcat.
I'm curently implementing this in ProjectHelper2 - so it'll actually
work in ant1.5 as well.
Costin
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>