Reputation: 10613
Specifically http://docs.groovy-lang.org/latest/html/api/groovy/util/GroovyScriptEngine.html and http://docs.groovy-lang.org/latest/html/api/groovy/lang/GroovyShell.html. In what situations would you use one over another?
Upvotes: 3
Views: 2387
Reputation: 37033
tl;dl: the script engine is for a groovy eco system; the shell for running scripts
The docs explain that in the section Groovy integration mechanisms.
From GroovyScriptEngine
The
groovy.util.GroovyScriptEngine
class provides a flexible foundation for applications which rely on script reloading and script dependencies. WhileGroovyShell
focuses on standaloneScript
's andGroovyClassLoader
handles dynamic compilation and loading of any Groovy class, theGroovyScriptEngine
will add a layer on top ofGroovyClassLoader
to handle both script dependencies and reloading.
further down the text is an example where a running script engine reloads classes automatically and also dependencies.
Upvotes: 4