【发布时间】:2014-01-31 18:21:55
【问题描述】:
我尝试在我的 groovy 类中导入 groovyx.net.http.RESTClient。 我的 groovy 类是这样的:
void getREST() {
def r = new RESTClient(url)
def response = r.get(path:'test',headers:['Authorization': "auth"] )
println "RESPONSE"
println response.headers
response.headers.each { it ->
println it
}
}
在我的课堂上,我像这样导入 RESTClient:
import groovyx.net.http.RESTClient
但是,我收到“无法解析类 groovyx.net.http.RESTClient”错误。我正在使用 NetBeans IDE 7.4。
我已经使用以下代码配置了 BuildConfig.groovy:
compile ":rest:0.8"
并添加 maven 存储库:
mavenRepo "http://repository.codehaus.org/"
但我仍然无法导入 RESTClient。我该怎么办?
【问题讨论】:
-
添加插件后你
complie应用了吗?还是刷新依赖? -
修复它。只需再添加一个:mavenRepo "grails.org/plugins"。这很有趣,文档中没有提到这个 repo...
-
不。您真正想要的是 [Grails Rest Client Builder][1]。 [1]:stackoverflow.com/a/24360224/30818
标签: grails