Details
Description
I have following sample DSLScriptBase,groovy file:
abstract class DSLScriptBase extends Script { def login() { println 'login' } }
and following script test.groovy:
def conf = new org.codehaus.groovy.control.CompilerConfiguration() conf.setScriptBaseClass('DSLScriptBase') def shell = new GroovyShell (conf) shell.evaluate('login()')
It works if DSLScriptBase.groovy is in the same directory as test.groovy.
But if I move DSLScriptBase.groovy to another directory (for example D:/Test) and modify test.groovy adding setClasspath:
def conf = new org.codehaus.groovy.control.CompilerConfiguration() def scriptDir = 'd:/Temp' conf.setClasspath(scriptDir) conf.setScriptBaseClass('DSLScriptBase') def shell = new GroovyShell(conf) shell.evaluate('login()')
I've got error: 'unable to resolve class DSLScriptBase'
It works fine in Grovy 2.1.9, but in 2.3.6 I can't figure any way to define script base classes on comp conf classpath (tried to create shell with ClassLoader, moving scriptbase into some package-subdir, precompile scriptbase - nothing works for me).
Please help
Attachments
Issue Links
- is related to
-
GROOVY-7018 GroovyClassLoader addClasspath RegexPattern issue
- Closed