For Ant, task level classpaths allow two tasks to use different versions of 
something like Commons Collections, which are often not binary compatible. This 
is similar to how OSGi and Jigsaw provide separation as well.

Some of the early Savant 2.0 builds, which used Groovy for plugins, ensured 
that all plugins had separate classloaders. In general, you want to isolate 
each component as much as possible. And you always want to remove as many 
dependencies from the root classpath as you can. In most cases, jarjar or 
something similar are ideal for repackaging top level dependencies. AS an 
example, Tomcat repackages all of the Commons libraries into Tomcat specific 
packages to prevent collisions with the web applications.

-bp


On Dec 8, 2009, at 11:35 AM, Endre Stølsvik wrote:

>        With respect to Ant's custom tasks, I am wondering whether I should
> also provide users with the ability of specifying a separate classpath
> per taskdef or whether this is overkill. I've often wondered why Ant
> bothers with this level of granularity instead of setting a
> project-level classpath instead.
> 
> I venture that it is because you want to catch API violations and suchlike. 
> So that one set of code doesn't call into the internals of some other set of 
> code that it shouldn't.
> 
> Endre.
>  
> 
> Gili
> 
> Stuart McCulloch wrote:
> > 2009/12/6 cowwoc <[email protected] <mailto:[email protected]>>
> >
> >     Hi,
> >
> >     What ClassLoader does Guice use by default when looking up classes?
> >     http://code.google.com/p/google-guice/wiki/ClassLoading talks about
> >     the "target class's class loader" but it doesn't specify what this
> >     refers to exactly. Are you referring to Class.getClassLoader()? I'm
> >     trying to programmatically append entries to the classpath...
> >
> >
> > most types are already loaded by virtue of the module bindings,
> > because Guice works primarily on type-literals and raw classes
> >
> > the only time Guice gets into classloading itself is:
> >
> >   1) creating proxies / enhanced classes / fast classes
> >
> >   2) loading classes referred to by strings (bindConstant)
> >
> > for 1) Guice takes the classloader of the type being proxied, etc.
> > (Class.getClassLoader) but it might also use a custom "bridge"
> > classloader for situations when Guice and the type cannot see
> > each other (such as OSGi / J2EE).
> >
> > for 2) Guice uses a simple Class.forName - though I'm thinking
> > it should also try the thread context classloader if there is one
> >
> > the best way to affect classloading is in the module where you're
> > setting up the bindings - you shouldn't need to mess around with
> > the internal stuff (at least once the patch for issue 343 is applied ;)
> >
> > can you explain more about what you're trying to do?
> >
> >     Thanks,
> >     Gili
> >
> >
> > --
> > Cheers, Stuart
> >
> > --
> >
> > You received this message because you are subscribed to the Google
> > Groups "google-guice" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group at
> > http://groups.google.com/group/google-guice?hl=en.
> 
> --
> 
> You received this message because you are subscribed to the Google Groups 
> "google-guice" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/google-guice?hl=en.
> 
> 
> 
> 
> --
> 
> You received this message because you are subscribed to the Google Groups 
> "google-guice" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/google-guice?hl=en.

--

You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.


Reply via email to