我全新安装了 Groovy 2.1.4,我想创建一个使用 HTTP 构建器的脚本。
我在脚本顶部添加了以下行:
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.6')
当我在 GroovyConsole 中运行脚本时,出现以下错误:
1 compilation error:
Exception thrown
VI 01, 2013 12:15:39 ODP. org.codehaus.groovy.runtime.StackTraceUtils sanitize
WARNING: Sanitizing stacktrace:
java.lang.RuntimeException: Error grabbing Grapes -- [download failed: commons-logging#commons-logging;1.1.1!commons-logging.jar]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
... (aso) ...
java.lang.RuntimeException: Error grabbing Grapes -- [download failed: commons-logging#commons-logging;1.1.1!commons-logging.jar]
当我在 Windows 命令行上运行以下命令时:
grape -V resolve org.codehaus.groovy.modules.http-builder http-builder 0.6
我得到同样的错误,即:
:: problems summary ::
:::: WARNINGS
[NOT FOUND ] commons-logging#commons-logging;1.1.1!commons-logging.jar (0ms)
==== localm2: tried
file:C:\Documents and Settings\Administrator/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar
:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
Error in resolve:
Error grabbing Grapes -- [download failed: commons-logging#commons-logging;1.1.1!commons-logging.jar]
当我尝试通过以下命令直接解决公共日志记录时:
grape -V resolve commons-logging commons-logging 1.1.1
我得到同样的错误,即not found
。
当我尝试通过适当的命令下载最新版本(即 1.1.3)时,它可以工作。但即使在那之后,解析 http-client 仍然失败。
问题出在哪里?