public void execute() { var other = context.createScript("script23Additional.groovy"); other.compute(); } public String getMyMessage() { return "MainScript"; }which implements the following
Script
interface:public interface Script { public void execute(); }and the additional script:
public void compute() { var script = context.getMainScriptObject(); context.echo(script.getMyMessage()); }We can create and execute the script by;
ScriptWrapper<Script> wrapper = new GroovyScriptWrapper<Script>(){ }; Script script = wrapper.getScript(); File file = new File(<our script file>); wrapper.installScript(file); script.execute();
public void execute() { context.createScript("script23Additional.groovy"); script = context.getScriptObject("script23Additional"); }which implements the following
Script
interface:public interface Script { public void execute(); }and the additional script:
public void compute() { context.echo("AdditionalScript"); }We can create and execute the script by;
ScriptWrapper<Script> wrapper = new GroovyScriptWrapper<Script>(){ }; Script script = wrapper.getScript(); File file = new File(<our script file>); wrapper.installScript(file); script.execute();
Copyright 2019-2020 Herve Girod. All Rights Reserved. Documentation and source under the BSD licence