maven报错:Return code is: 501 , ReasonPhrase:HTTPS Required

Posted Ericzya

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了maven报错:Return code is: 501 , ReasonPhrase:HTTPS Required相关的知识,希望对你有一定的参考价值。

今天把一个去年没做完的项目翻出来做时,发现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的主要内容,如果未能解决你的问题,请参考以下文章

Maven deploy Return code is: 400

mvn deploy 报错:Return code is: 400, ReasonPhrase: Bad Request. ->

nagios报错Return code of 255 is out of bounds

myeclipse中使用maven插件的时候,报错-Dmaven.multiModuleProjectDirectory system propery is not set.

maven自建仓库 Return code : 405

Maven运行报错:-Dmaven.multiModuleProjectDirectory system propery is not set.