« Return to Thread: GMaven 'execute' goal + Class.forName

Re: GMaven 'execute' goal + Class.forName

by Jason Dillon :: Rate this Message:

Reply to Author | View in Thread

This may be due to Class.forName() not looking at the TCL, actually I  
don't recommend *ever* using Class.forName() because of this... or  
really, use the TCL, then fall-back to Class.forName().  The classes  
are there on the thread context classloader (aka TCL).

IMO Sun's impl of Class.forName() is broke for more than the simplest  
of configurations... so I recommend getting your dependency to  
properly load classes in a non-trivial environment by using the TCL.

--jason


On Jun 23, 2009, at 1:21 AM, Tom Nichols wrote:

> I seem to have a problem with how GMaven does its dependency
> classloading, particularly in relation to dependencies from
> groovy:execute scripts.
>
> From a script, I can create an instance of a given class, but can't
> load that same class via Class.forName.  Now I don't mind so much
> about that, but dependent code that I'm trying to execute relies on
> this behavior.
>
> Example POM attached.  You'll see that the first line prints out the
> class' name (so it's on the classpath) but this script's classloader
> fails to load the class when calling Class.forName.
>
> Bug report?
>
> Thanks.
> -Tom
> <
> pom
> .xml
> >---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: GMaven 'execute' goal + Class.forName