GroovyDslExecutor (String text, String fileName) { CompilerConfiguration configuration = new CompilerConfiguration(); configuration.setScriptBaseClass(GdslScriptBase.class.getName()); GroovyShell shell = new GroovyShell(GroovyDslExecutor.class.getClassLoader(), configuration); GdslScriptBase script = DefaultGroovyMethods.asType(shell.parse(text, StringUtil.sanitizeJavaIdentifier(fileName)), GdslScriptBase.class); script.run(); return new GroovyDslExecutor(script, fileName); }