public Object evaluateScript()

in src/main/java/org/apache/maven/shared/scriptinterpreter/GroovyScriptInterpreter.java [66:93]


    public Object evaluateScript(String script, Map<String, ?> globalVariables, PrintStream scriptOutput)
            throws ScriptEvaluationException {
        PrintStream origOut = System.out;
        PrintStream origErr = System.err;

        ClassLoader curentClassLoader = Thread.currentThread().getContextClassLoader();
        try {

            if (scriptOutput != null) {
                System.setErr(scriptOutput);
                System.setOut(scriptOutput);
            }

            GroovyShell interpreter = new GroovyShell(
                    childFirstLoader,
                    new Binding(globalVariables),
                    new CompilerConfiguration(CompilerConfiguration.DEFAULT));

            Thread.currentThread().setContextClassLoader(childFirstLoader);
            return interpreter.evaluate(script);
        } catch (Throwable e) {
            throw new ScriptEvaluationException(e);
        } finally {
            Thread.currentThread().setContextClassLoader(curentClassLoader);
            System.setErr(origErr);
            System.setOut(origOut);
        }
    }