在stackoverflow上查了下
今天把一个去年没做完的项目翻出来做时,发明maven无法正常导入依赖。查抄了一遍项目配置,,没发明有什么问题。而且依赖在本地货仓存在。
随后发明报错:Failed to transfer file:*********. Return code is: 501 , ReasonPhrase:HTTPS Required. 这时候仿佛发明了什么重点————我们需要将maven配置改削一下:
<!-- 中央货仓1 --> <mirror> <id>repo1</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>https://repo1.maven.org/maven2/</url> </mirror> <!-- 中央货仓2 --> <mirror> <id>repo2</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>https://repo2.maven.org/maven2/</url> </mirror>
随后发明可以正常导入依赖了。
在stackoverflow上查了下,发明有人也遇到了这个问题:
Recently Maven build jobs running in Jenkins are failing with the below exception saying that they could not pull dependencies from Maven Central and should use HTTPS. I am not sure how to change the requests from HTTP to HTTPS. Could someone guide me on this matter?
回答如下:
Effective January 15, 2020, The Central Repository no longer supports insecure communication over plain HTTP and requires that all requests to the repository are encrypted over HTTPS.
所以这个问题的泉源就是maven中央货仓此刻只撑持HTTPS协议,我们改一下就行。
maven报错:Return code is: 501 , ReasonPhrase:HTTPS Required
温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/31000.html