On Mon, 23 Jul 2001, Conor MacNeill wrote: > Daniel, > > > -----Original Message----- > > What I don't understand is why the Ant classloader is not the > > context classloader as well. > > Context classloaders are not part of JDK 1.1 so I had not set it until > recently. In a recent change, I have set the context classloader for <java> > tasks by reflection. I haven't however, extended that to taskdefs. Hmmm, we > could do that just prior to execute, I guess, assuming the context loader is > not required for task configuration.
I think it's important to _use_ the context classloader, not only to set it ( i.e. in all Class.forName or similar ). Assuming ant is run inside a webapp or similar environment ( where user code is loaded in a separate classloader ), there are few cases where the current code will not work. Please take a look at org.apache.tomcat.util.compat, it's ( IMHO ) a cleaner solution to the problem, with no reflection involved ( so a bit faster ). We use the package extensively in all places where JDK1.2 features are needed ( tc3.x is also 1.1 compatible ). Sine I run into this problem quite a few times ( with ant in classpath, and tasks in the webapp ), I would be happy to backport it, if you want. Costin
