GroovyClassLoader () { return new GroovyClassLoader(Thread.currentThread().getContextClassLoader(), compilerConfiguration) { @Override public Class<?> loadClass(String name, boolean lookupScriptFiles, boolean preferClassOverScript) throws ClassNotFoundException, CompilationFailedException { Class<?> aClass; try { aClass = super.loadClass(name, lookupScriptFiles, preferClassOverScript); } catch (NoClassDefFoundError e) { throw new ClassNotFoundException(name, e); } catch (LinkageError e) { throw new RuntimeException("Problem loading class " + name, e); } return checkWellFormed.loadDependencies(aClass); } }; }