> From: Peter Reilly [mailto:[EMAIL PROTECTED] > > > Hi, > This sounds nice but does it save that much on > > <project name="x" xmlns:lib="antlib:foo.bar"> > > <typedef resource="foo/bar/antlib.xml" uri="antlib:foo.bar"> > <classpath>.....</classpath> > </typedef> > > <lib:mytask ..../> <!-- The antlib loaded using the > classloader for "foo.bar" --> > > </project> >
Well I could ask the same question about antlib's namespace. Why having some magic URI when users could just write: <typedef resource="foo/bar/antlib.xml" uri="antlib:foo.bar"/> and make the loading explicit. As the URI protocol "antlib:" provides a shortcut for the <typedef/> above, I am just thinking on providing something similar for the classpath declaration when needed. <classpath id="foo.bar">.....</classpath> BTW, do we have the concept of classloader as a first class object? I can never remember. One thing that one wants to have is a way to define one classloader that can be used by multiple antlibs so that the tasks and types are compatible. Using <classpath/> may befine different classloaders and at the end you loose the ability to use them as building blocks. Do we have a way to guarantee that the same classloader can be used in two diferent places? Jose Alberto > Peter > > > Jose Alberto Fernandez wrote: > > >Hi, I have been giving some thought on ways to solve this > nagging issue > >of needing to put antlib jars on the lib directory. > > > >We hear over and over people wanting to keep their third party > >libraries out of -lib because they are only for an specific project. > > > >As I see it, our road block has been how to tell in succinct > way in the > >buildfile that when loading the namespace "antlib:foo.bar" > you should > >use this or that classpath or classloader. > > > >A simple solution could be to achieve this by name association: > > > >- When ANT tries to find and load the resource for > "antlib:foo.bar" it > >will first look for a reference named "foo.bar" representing a > >classloader (or classpath?). If an object of the correct > type is found, > >then this classloader will be user for resolving and loadding the > >antlib, otherwise the default classloader will be use, as it > is today. > > > >So with this in place, one could write things like: > > > ><project name="x" xmlns:lib="antlib:foo.bar"> > > > > <classpath id="foo.bar">.....</classpath> > > > > <lib:mytask ..../> <!-- The antlib loaded using the > classloader for > >"foo.bar" --> > > > ></project> > > > >Before jumping on a code proposal, does this sound a the > right or good > >solution? Does this cover enough of the use cases? > > > >Let me know what you people think. > > > >Jose Aberto > > > > > > > > > > > > > >------------------------------------------------------------- > ---------- > >- > > > >--------------------------------------------------------------------- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]