当HEAD请求失败时

当HEAD请求失败时

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

问题描述



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

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




  • Bitbucket重定向到亚马逊网址

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



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

否则,可能是因为Amazon不接受HEAD请求中的签名,它应该与GET中的签名不同,如插件,并按照所述手动编写缓存

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

Gradle fails to download it, with error message

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无法下载依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 08:59