当HEAD请求失败时,Gradle无法下载依赖关系 [英] Gradle failing to download dependency when HEAD request fails

查看:750
本文介绍了当HEAD请求失败时,Gradle无法下载依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



Gradle无法下载它,并带有错误消息


无法HEAD' https:/ /bitbucket.org/....zip 。收到来自服务器的状态代码403:Forbidden


我研究过它,看起来这是因为:




  • Bitbucket重定向到亚马逊网址

  • 亚马逊网址不接受HEAD请求,只接受GET请求



我可以通过curl测试该URL来检查,并且在发送带curl的HEAD请求时也得到了403 Forbidden。 b
$ b

否则,可能是因为Amazon不接受HEAD请求中的签名,它应该与GET中的签名不同,如。/ b>
$ b $ / $ / $> $ / $>
$ b

有没有办法解决这个问题?我可以告诉Gradle跳过HEAD请求并直接进入GET请求吗?

我通过使用 gradle-download-task 插件,并按照此处所述手动编写缓存

I have set up a dependency in my Gradle build script, which is hosted on Bitbucket.

Gradle fails to download it, with error message

Could not HEAD 'https://bitbucket.org/....zip'. Received status code 403 from server: Forbidden

I looked into it, and it seems that this is because :

  • Bitbucket redirects to an amazon url
  • the Amazon url doesn't accept HEAD requests, only GET requests

I could check that by testing that URL with curl, and I also got a 403 Forbidden when sending a HEAD request with curl.

Otherwise, it could be because Amazon doesn't accept the signature in the HEAD request, which should be different from the GET one, as explained here.

Is there a way around this ? Could I tell Gradle to skip the HEAD request, and go straight to the GET request ?

解决方案

I worked around the problem by using the gradle-download-task plugin, and manually writing caching as explained here

这篇关于当HEAD请求失败时,Gradle无法下载依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆