Using the example given in the documentation for ClassLoader I am able to load a class which is in the same package as ${it}
:
ClassLoader cl = it.class.getClassLoader()
def builder = cl.loadClass("hudson.plugins.emailext.plugins.ContentBuilder", true).newInstance()
But when I try to load from a different package like this:
def logParserParser = cl.loadClass("hudson.plugins.logparser.LogParserParser", true).newInstance()
I get the error:
Exception: javax.script.ScriptException: java.lang.ClassNotFoundException: hudson.plugins.logparser.LogParserParser
.
How can I load a class from a different package?
UPDATE:
I was able to make a work around to fix my specific problem. It would be a lot nicer if the class would just resolve. See my answer to another of my questions here.