在Groovy类中导入groovyx.net.http.RESTClient [英] import groovyx.net.http.RESTClient in Groovy class

查看:313
本文介绍了在Groovy类中导入groovyx.net.http.RESTClient的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在我的groovy类中导入groovyx.net.http.RESTClient。
我的groovy类是这样的:

  void getREST(){

def r = new RESTClient(url)
def response = r.get(path:'test',headers:['Authorization':auth])
printlnRESPONSE
println response。头文件
response.headers.each {it - >
println it
}

}

我的课,我导入RESTClient像这样:

  import groovyx.net.http.RESTClient 

但是,我得到无法解决类groovyx.net.http.RESTClient错误。



我已经使用以下代码配置了BuildConfig.groovy:

  compile:rest:0.8

并添加maven回购:

  mavenRepohttp://repository.codehaus.org/

但我仍然无法导入RESTClient。我应该怎么做? 解决方案

解决它。只需再向BuildConfig添加一个回购:

  mavenRepohttp://grails.org/plugins


I try to import groovyx.net.http.RESTClient in my groovy class. My groovy class is like this:

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
    }

}

In my class, i import the RESTClient like this:

    import groovyx.net.http.RESTClient 

However, i got "unable to resolve class groovyx.net.http.RESTClient" error. I am using NetBeans IDE 7.4.

I have already config the BuildConfig.groovy with the following code:

    compile ":rest:0.8"

and add the maven repo:

    mavenRepo "http://repository.codehaus.org/"

But I still can't import the RESTClient. What should I do with that?

解决方案

Fix it. just add one more repo to the BuildConfig:

mavenRepo "http://grails.org/plugins"

这篇关于在Groovy类中导入groovyx.net.http.RESTClient的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆