groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pascal Schumacher (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (GROOVY-7097) ScriptBase class can't be resolved if not in current directory even if CompilerConf classpath is set
Date Sun, 05 Jul 2015 15:11:04 GMT

     [ https://issues.apache.org/jira/browse/GROOVY-7097?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Pascal Schumacher resolved GROOVY-7097.
---------------------------------------
       Resolution: Fixed
         Assignee: Pascal Schumacher
    Fix Version/s: 2.4.4

The example works for me on current master. I guess the fix for [ 	GROOVY-7018] also fixed
this.

> ScriptBase class can't be resolved if not in current directory even if CompilerConf classpath
is set
> ----------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-7097
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7097
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.5, 2.3.6, 2.3.7
>         Environment: Windows 7 64 bit, Groovy 2.3.6
>            Reporter: Christopher Barteczko
>            Assignee: Pascal Schumacher
>             Fix For: 2.4.4
>
>
> I have following sample DSLScriptBase,groovy file:
> {code}
> abstract class DSLScriptBase extends Script {
>   def login() {
>     println 'login'
>   }
> }
> {code}
> and following script test.groovy:
> {code}
> def conf =  new org.codehaus.groovy.control.CompilerConfiguration()
> conf.setScriptBaseClass('DSLScriptBase')
> def shell = new GroovyShell (conf)
> shell.evaluate('login()')
> {code}
> 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:
> {code}
>  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()')
> {code}
> 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 :-)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message