GroovyShell 和 GroovyScriptEngine 有什么区别?
What's the difference between GroovyShell and GroovyScriptEngine?
具体来说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。在什么情况下你会使用一个而不是另一个?
tl;dl:脚本引擎用于 groovy 生态系统; 运行 脚本的 shell
文档在 Groovy integration mechanisms.
部分解释了这一点
The groovy.util.GroovyScriptEngine
class provides a flexible foundation for applications which rely on script reloading and script dependencies. While GroovyShell
focuses on standalone Script
's and GroovyClassLoader
handles dynamic compilation and loading of any Groovy class, the GroovyScriptEngine
will add a layer on top of GroovyClassLoader
to handle both script dependencies and reloading.
文本的下方是一个示例,其中 运行 脚本引擎自动重新加载 类 以及依赖项。
具体来说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。在什么情况下你会使用一个而不是另一个?
tl;dl:脚本引擎用于 groovy 生态系统; 运行 脚本的 shell
文档在 Groovy integration mechanisms.
部分解释了这一点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.
文本的下方是一个示例,其中 运行 脚本引擎自动重新加载 类 以及依赖项。