Map<String, Object> jointCompilationOptions = new HashMap<String, Object>();
jointCompilationOptions.put("stubDir", spec.getGroovyCompileOptions().getStubDir());
jointCompilationOptions.put("keepStubs", spec.getGroovyCompileOptions().isKeepStubs());
configuration.setJointCompilationOptions(jointCompilationOptions);
URLClassLoader classPathLoader = new GroovyCompileTransformingClassLoader(new DefaultClassPath(spec.getClasspath()));
GroovyClassLoader compileClasspathClassLoader = new GroovyClassLoader(classPathLoader, null);
FilteringClassLoader groovyCompilerClassLoader = new FilteringClassLoader(GroovyClassLoader.class.getClassLoader());
groovyCompilerClassLoader.allowPackage("org.codehaus.groovy");
groovyCompilerClassLoader.allowPackage("groovy");