配置Jenkins报错的解决方法 Blocked mirror for repositories

569 阅读1分钟

在学习jenkins的使用过程中,完成了基本的配置后,想要启动构建的时候出现了报错

image.png 网上的资料比较少,于是尝试自己解决。

1.定位问题点。

Blocked mirror for repositories: [nexus-aliyun (http://maven.aliyun.com/nexus/content/groups/public, default, releases)] and 'parent.relativePath' points at no local POM @ line 5, column 13

翻译过来的大致意思就是阿里云的镜像被屏蔽,找到问题所在。

2.进行相应搜索,得到原因。

是因为Maven在升级到3.8.1以后,从安全角度考虑,默认将https的远端仓库屏蔽掉了。

3.解决问题

第一种解决方式就是把maven降级到3.8.1以下,比较麻烦,没有进行实操。

第二种解决方法,将远程镜像仓库的连接改为https连接,于是找到本地maven仓库,进入conf文件夹,打开setting.xml文件,定位阿里云镜像位置

<mirror>
  <id>nexus-aliyun</id>
  <mirrorOf>*</mirrorOf>
  <name>Nexus aliyun</name>
  <url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>

将其修改为

<mirror>
  <id>nexus-aliyun</id>
  <mirrorOf>*</mirrorOf>
  <name>Nexus aliyun</name>
  <url>https://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>

保存,重新启动jenkins

image.png

成功进行构建,问题解决。