Maven关闭Http强制代理

背景

今天使用Maven编译项目的时候出现如下报错:

1
[WARNING] Could not validate integrity of download from http://0.0.0.0/

原因

Maven3.8.1以上版本针对http开头的仓库,强制会进行一层本地代理

解决

方案一、降低版本到3.8.1以下
方案二、修改{maven-install-path}下的settings.xml文件。注释掉以下内容即可:

1
2
3
4
5
6
7
<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>

我用homebrew安装的maven,对应的路径是【/usr/local/Cellar/maven/3.8.2/libexec/conf】