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

本文档介绍了在使用Maven 3.8.6时遇到的由于maven-default-http-blocker阻止http链接导致的依赖下载失败问题。错误信息显示阿里云镜像使用的是http协议。解决方案包括降级Maven版本或者修改setting.xml配置,将阿里云镜像URL改为https。通过注释掉设置文件中相关代码并更新为安全的HTTPS链接,可以成功解决此问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、情景复现

在这里插入图片描述

二、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>