2

我知道您可以@GrabResolver(name='restlet', root='http://maven.restlet.org/')在 groovy 文件的开头使用。但是,我希望能够在我使用 groovysh 时进行此调用。

有没有办法做到这一点?

4

1 回答 1

2
groovy:000> import groovy.grape.Grape
===> [import groovy.grape.Grape]
groovy:000> Grape.addResolver(name:'restlet', root:'http://maven.restlet.org/')
===> null

@GrabResolver内部在使用注解的类中添加上述调用 ( Grape.addResolver())。默认情况下,此行为由initClass注释中设置为 true 的属性驱动。

于 2014-02-12T03:17:00.090 回答