maven升级版本后报错:Blocked mirror for repositories

出现问题的场景:

当 Maven 升级到3.8.1 之后,执行maven就会出现如下报错信息:

maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories

原因:

maven在3.8.1 的默认配置文件中增加了一组标签,如果仓库镜像是 http 而不是https 就会被拦截禁止访问,而当前公司私服一般是http 而不支持https。

解决方法:

方法一:降低Maven 版本到3.8.1 以下

方法二:增加节点

java 复制代码
<mirror>
    <id>insecure-repo</id>
    <mirrorOf>external:http:*</mirrorOf>
    <url>http://www.ebi.ac.uk/intact/maven/nexus/content/repositories/ebi-repo/</url>
    <blocked>false</blocked>
</mirror>

方法三:将镜像仓库从http 变成https

方法四:注释掉 $MAVEN_HOME/conf/settings.xml 中的拦截标签

找到你IDEA中指定的settings.xml配置文件,注释掉如下配置即可:

java 复制代码
<mirror>
    <id>maven-default-http-blocker</id>
    <mirrorOf>external:http:*</mirrorOf>
    <name>Pseudo repository to mirror external repositories initially using HTTP.</name>
    <url>http://0.0.0.0/</url>
    <blocked>true</blocked>
</mirror>

参考: https://baijiahao.baidu.com/s?id=1771199108970618860&wfr=spider&for=pc

相关推荐
云云只是个程序马喽21 小时前
海外短剧系统开发_云微传媒:多语言短剧平台定制与变现解决方案
java·php
plainGeekDev21 小时前
RecyclerView.Adapter → ListAdapter
java·kotlin·gradle
J2虾虾21 小时前
Spring AI Alibaba - 人工介入(Human-in-the-Loop)
java·人工智能·spring
Old Uncle Tom21 小时前
Harness Engineering 综述
java·开发语言·数据库
星原望野21 小时前
JAVA:策略模式的实战使用
java·开发语言·策略模式
LJianK121 小时前
java多态
java·开发语言·python
z落落1 天前
C# 构造函数(无参/有参/重载/this)+析构函数(终结器)|GC 垃圾回收
java·开发语言·c#
武子康1 天前
Java-12 深入浅出 MyBatis 二级缓存详解:跨 SqlSession 共享与失效机制
java·后端
考虑考虑1 天前
JDK9中的Set.of()使用注意
java·后端·java ee
plainGeekDev1 天前
findViewById → ViewBinding
java·kotlin·gradle