我是一个 groovy n00b 并尝试使用 http-builder,但网络上的所有示例都引用相同的内容@Grab
声明不起作用。我认为这是因为 codehaus.org 不再托管常规内容。我尝试过从以下位置下载源代码github https://github.com/jgritman/httpbuilder并使用 Maven 构建它,但构建失败。
我应该如何以及在哪里获得 groovy 的 httpbuilder ?
我已经尝试过的事情:
从中删除葡萄目录这个帖子 https://stackoverflow.com/questions/31498714/cannot-install-httpbuilder没用。
我从以下位置得到了这段代码片段这另一篇文章 https://stackoverflow.com/questions/28888337/installing-httpbuilder-for-groovy,但这对我也不起作用。
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7' )
def http = new groovyx.net.http.HTTPBuilder('http://www.codehaus.org')
println http
这是 IntelliJ 控制台中的错误:
/Users/kenny/Sites/inadaydevelopment.com/reports/fetch_windows_appstore_report.groovy
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
General error during conversion: Error grabbing Grapes --
[download failed: xerces#xercesImpl;2.9.1!xercesImpl.jar,
download failed: xml-apis#xml-apis;1.3.04!xml-apis.jar]
EDIT 1:
尝试从命令行运行它,仍然出现相同的错误消息。
Tried grab artifacts
在 IntelliJ 中,但这也失败了:
我想知道这是否与 Mac 和宾果游戏有关。我将此脚本上传到我的 CentOS 服务器,它运行得很好。有一些与 MacOSX+groovy 相关的东西导致了这个问题。