Class ScriptRunner
java.lang.Object
org.apache.maven.shared.scriptinterpreter.ScriptRunner
public class ScriptRunner
extends java.lang.Object
Runs pre-/post-build hook scripts.
- Author:
- Benjamin Bentmann
-
Constructor Summary
Constructors Constructor Description ScriptRunner()
Creates a new script runner with BSH and Groovy interpreters. -
Method Summary
Modifier and Type Method Description void
addScriptInterpreter(java.lang.String id, ScriptInterpreter scriptInterpreter)
Add new script Interpretervoid
run(java.lang.String scriptDescription, java.io.File basedir, java.lang.String relativeScriptPath, java.util.Map<java.lang.String,?> context, ExecutionLogger logger)
Runs the specified hook script (after resolution).void
run(java.lang.String scriptDescription, java.io.File scriptFile, java.util.Map<java.lang.String,?> context, ExecutionLogger logger)
Runs the specified hook script.void
setClassPath(java.util.List<java.lang.String> classPath)
Sets the additional class path for the hook scripts.void
setGlobalVariable(java.lang.String name, java.lang.Object value)
Sets a global variable for the script interpreter.void
setScriptEncoding(java.lang.String encoding)
Sets the file encoding of the hook scripts.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
ScriptRunner
public ScriptRunner()Creates a new script runner with BSH and Groovy interpreters.
-
-
Method Details
-
setGlobalVariable
public void setGlobalVariable(java.lang.String name, java.lang.Object value)Sets a global variable for the script interpreter.- Parameters:
name
- The name of the variable, must not benull
.value
- The value of the variable, may benull
.
-
setClassPath
public void setClassPath(java.util.List<java.lang.String> classPath)Sets the additional class path for the hook scripts. Note that the provided list is copied, so any later changes will not affect the scripts.- Parameters:
classPath
- The additional class path for the script interpreter, may benull
or empty if only the plugin realm should be used for the script evaluation. If specified, this class path will precede the artifacts from the plugin class path.
-
setScriptEncoding
public void setScriptEncoding(java.lang.String encoding)Sets the file encoding of the hook scripts.- Parameters:
encoding
- The file encoding of the hook scripts, may benull
or empty to use the platform's default encoding.