springboot导入父依赖报错:Non-resolvable parent POM for...failed to transfer from http://0.0.0.0/...

一、情景复现

在这里插入图片描述

二、BUG提示

Non-resolvable parent POM for com.tt:myproject:0.0.1-SNAPSHOT: org.springframework.boot:spring-boot-starter-parent:pom:1.5.9.RELEASE failed to transfer from http://0.0.0.0/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of maven-default-http-blocker has elapsed or updates are forced. Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:1.5.9.RELEASE from/to maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories: [alimaven (http://maven.aliyun.com/nexus/content/groups/public/, default, releases)]

三、原因分析及解决方法

(一)原因分析: maven-default-http-blocker 拦截 http 链接下载依赖。
Maven 从3.8.1开始在 setting.xml 配置文件中,增加了一个默认镜像 maven-default-http-blocker 来阻止从 HTTP 链接下载不安全的依赖库。我当前使用的 Maven 版本是 3.8.6,可以看到同样是有该拦截器的。
在这里插入图片描述
我配置的阿里云镜像确实是使用的 http 协议地址:
在这里插入图片描述

(二)解决方法

  1. 方法一:降级 Maven 版本到 3.8.1 以下;
  2. 方法二:使用 https 进行下载(推荐)。

找到 Maven 的 setting.xml 配置文件,将上述截图代码进行注释,修改阿里云镜像 url:

<mirror>
	<id>alimaven</id>
	<mirrorOf>central</mirrorOf>
	<name>aliyun maven</name>
	<url>https://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值