Maven 报错 Could not transfer artifact 和 501 HTTPS Required

image.png
image.png

Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.3.4.RELEASE from http://repo1.maven.org/maven2/ was cached in the local repository, resolution will not be reattempted until the update interval of mirrorId has elapsed or updates are forced. Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.3.4.RELEASE from/to mirrorId (http://repo1.maven.org/maven2/): Transfer failed for http://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.3.4.RELEASE/spring-boot-starter-parent-2.3.4.RELEASE.pom 501 HTTPS Required

Dependency 'com.alibaba:fastjson:1.2.73' not found


解决方法:

因为maven2使用了https协议,所以需要添加ssl证书,或者忽略ssl错误,我之前采用的是忽略,创建了新的项目以后需要重新设置,。具体处理方法如下

-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true
image

-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true

需要注意的是提示的错误可能不是ssl错误,所以导致没有直接追踪到问题根源,

问题2:501 HTTPS Required.

在2020年01月15日maven的两大远程库都停止了对http协议的支持,改成了https,使用https就涉及到了认证问题。

501 HTTPS Required. Use https://repo1.maven.org/maven2/More information at https://links.sonatype.com/central/501-https-required

解决方法:

https://maven.aliyun.com/mvn/view

要解决这个问题可以暂时使用一下仓库地址,这个也是官方给出的解决方案:

             repo1        central        Human Readable Name for this Mirror.        http://insecure.repo1.maven.org/maven2/    

当然如果能够使用Maven国内镜像就更好比如阿里云的镜像,既支持http协议又支持https协议。

    aliyunmaven    central    central    https://maven.aliyun.com/repository/central

你可能感兴趣的:(Maven 报错 Could not transfer artifact 和 501 HTTPS Required)