If you check Definer.java, there is already a way to reuse a classloader.
Costin Jose Alberto Fernandez wrote: > One of the things that most anoyed me of the current architecture of ANT > if the way ClassPaths are managed during the build. Almost every task > that can be passed a <path> for finding classes, creates its own > AntClassLoader. As a consecuence ref-ids become incompatible very easily > unless the classes are all on the system classpath. > > By creating AntClassLoaders on those indifvidual tasks we are forcing ANT > to reload class definitions a lot, which has to slow things down, IMHO. > > I do not have a full solution (backward compatible and all), but would > like to propose doing some brainstorming to find a better way to do this > (at least on most cases). > > Here are some ideas I have been thinking about, for you guys to shread to > pieces: > > We continue declaring <path>s the way we do, but allow to specify caching > of classloaders: > > <path cacheclasses=true> > ... > </path> > > The Path class will have a new methods: > > ClassLoader getCachedLoader(); > void setCachedLoader(ClassLoader cl); > > these methods would be used by AntClassLoader to decide whether to > actually create a new ClassLoader of simply delegate to the cached one. So > users will continue to use things as they do today, and just the internals > of this implementations will know about this things. > > Of course, we still need some rules to decide when it is safe to use the > same classloader and when not. Given the configuration of the Path object. > > Any comments, ideas, do you guys thing there is any hope on something like > this to work? > > Jose Alberto -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>