2
我有奇怪的问题与Groovy和HttpBuilder库。首先要注意的是,我对Groovy很新鲜。MissingMethodException在基于教程的代码和昨天工作
我已经在教程中使用了我的代码。它只是从HTTP服务器加载文件列表。代码昨天工作,今天(工作区构建之后)没有。
的问题是:
Caught: groovy.lang.MissingMethodException: No signature of method: groovyx.net.http.HTTPBuilder.request() is applicable for argument types: (groovyx.net.http.Method, groovyx.net.http.ContentType, pl.linfo.groovy.samples.HttpTest$_main_closure1)
Possible solutions: request(groovyx.net.http.Method, groovy.lang.Closure)
的代码是:
def http = new HTTPBuilder('http://nbp.pl/Kursy/xml/dir.txt')
http.request(GET, TEXT) {
response.success = { resp, reader ->
println "${resp.statusLine}"
files = reader.text.split ('\r\n')
}
response.'404' = {
println "Not found!"
return
}
};
运行环境是的Eclipse 3.6
我想这个问题是常规编制问题,Groovy代码重新编译后的片段不再匹配关闭。然而,作为Groovy的新手,我有问题想知道发生了什么,所以请帮忙。
正如我写的,代码为我运行,并在Eclipse中。但是,记事本驱动的开发肯定不适合我,我希望它在IDE中工作:( – 2011-05-19 10:34:29