Skip to content

Latest commit

 

History

276 Commits

Folders and files

Apache Maven Script Interpreter

Apache License, Version 2.0, January 2004 Maven Central Reproducible Builds Verify

A library that runs Groovy scripts from Java code. Maven plugins use it to run the scripts that belong to a build: the Maven Invoker Plugin runs the selector, pre-build and post-build scripts of each integration test with it.

ScriptRunner finds a script by name, passes it variables and a shared context, puts extra entries on its classpath and captures its output in a log file. BeanShell scripts are deprecated since 1.10 and still run, with a warning.

Use

The library needs Java 8 or later and runs scripts with Groovy 4.

try (ScriptRunner scriptRunner = new ScriptRunner()) {
    scriptRunner.run("post-build script", basedir, "verify", context, new FileLogger(logFile));
}

This runs verify.groovy from basedir. The run fails with a ScriptException when the script throws, or returns anything other than true or nothing.

Build

mvn verify

Releases

Packages

Used by

Contributors

Languages