Groovy - 抓取 - 下载失败 [英] Groovy - Grab - download failed
问题描述
我重新安装了Groovy 2.1.4,我想创建一个使用HTTP构建器的脚本。
I have a fresh installation of Groovy 2.1.4 and I'd like to create a script that uses HTTP builder.
我已经在脚本的顶部:
I've added the following line at the top of the script:
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.6')
当我在GroovyConsole中运行脚本时,我得到以下错误:
When I run the script in GroovyConsole, I get the following error:
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命令行上:
When I run the following command on the Windows command line:
grape -V resolve org.codehaus.groovy.modules.http-builder http-builder 0.6
我得到同样的错误,即:
I get the same error, i.e.:
:: 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]
当我尝试通过以下命令直接解析commons-logging:
When I try to resolve commons-logging directly, via the following command:
grape -V resolve commons-logging commons-logging 1.1.1
我得到相同的错误,即 not found
。
I get the same error, i.e. not found
.
当我尝试通过相应的命令下载最新版本,即1.1.3时,有用。但是即使在这之后,解析http-client仍然失败。
When I instead try to download the latest version, i.e. 1.1.3, via the appropriate command, it works. But even after that, resolving the http-client still fails.
问题在哪里?
Where's the problem?
推荐答案
看起来您的Grape设置仅用于查看库的本地 .m2
目录。检查你的 grapeConfig.xml
配置文件。 (如果你没有,你可以创建它 - 它应该放在你的 groovysh.history
和葡萄
cache目录由Groovy创建。)您可以复制 Groovy Grape参考页面。
It looks like your Grape settings are set only to look in your local .m2
directory for the library. Check your grapeConfig.xml
configuration file. (If you don't have one, you can create it--it should go in the same directory where your groovysh.history
and grapes
cache directory are created by Groovy.) You can copy the example file shown on the Groovy Grape reference page.
如果没有帮助,我会尝试删除葡萄
缓存目录,然后重试。
If that doesn't help, I would try deleting your grapes
cache directory and try it again.
这篇关于Groovy - 抓取 - 下载失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!