gpt4 book ai didi

groovy - 为什么 Grapes 会抢走一个我没有要的 jar ?

转载 作者:行者123 更新时间:2023-12-02 17:29:57 25 4
gpt4 key购买 nike

我想编写一个使用 Apache HttpClient 4.1 的简​​单 Groovy 脚本,由于我没有它的 jar,所以我想用 Grapes 获取它。到目前为止,我的脚本中只有..

@Grab(group='org.apache.httpcomponents', module='httpclient', version='4.0')
import org.apache.http.impl.client.DefaultHttpClient;

但是当我运行它时我得到一个异常..

java.lang.RuntimeException: Error grabbing Grapes -- [download failed: commons-logging#commons-logging;1.1.1!commons-logging.jar]

当我只请求 http 客户端时,为什么 Grapes 会获取公共(public)日志记录?如果是因为后者需要前者,那么我是否需要自己显式抓取http客户端的所有依赖jar?我怎么知道它们是什么?有没有办法告诉 Grapes 自己做这个?

最佳答案

这是因为 commons-logging 是一个传递依赖,即 org.apache.httpcomponents:httpclient 的依赖。

您可能遇到了问题,因为您的本地 Maven 存储库没有 commons-logging 并且不知道如何(或未配置)查找它。

关于groovy - 为什么 Grapes 会抢走一个我没有要的 jar ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34913332/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com