如何使用GrabResolver在groovysh中使用远程repo

如何使用GrabResolver在groovysh中使用远程repo,groovy,grape,Groovy,Grape,我知道您可以使用@grabsolver(name='restlet',root='s')http://maven.restlet.org/)在groovy文件的开头。然而,我希望能够在groovysh中执行此调用 有办法做到这一点吗 groovy:000> import groovy.grape.Grape ===> [import groovy.grape.Grape] groovy:000> Grape.addResolver(name:'restlet', root:'h

我知道您可以使用
@grabsolver(name='restlet',root='s')http://maven.restlet.org/)
在groovy文件的开头。然而,我希望能够在groovysh中执行此调用

有办法做到这一点吗

groovy:000> import groovy.grape.Grape
===> [import groovy.grape.Grape]
groovy:000> Grape.addResolver(name:'restlet', root:'http://maven.restlet.org/')
===> null
@grabsolver
在使用注释的类中内部添加上述调用(
Grape.addResolver()
)。默认情况下,此行为由注释中设置为true的
initClass
属性驱动