jenkins构建项目时报错(和nexus有关):Could not find metadata XXXXXX

1 背景

最近在部署java后端代码的时候jenkins突然报错,查看控制台输出后,发现是maven找不到maven-metadata.xml文件(关键报错已在下方完整日志处用蓝色标出),因而识别不了websocket的LATEST版本号,无法构建项目(个人理解)。

2 完整报错日志

[ERROR] Failed to execute goal on project paladin-analysis-service: Could not resolve dependencies for project com.baosight.paladin:paladin-analysis-service:jar:1.0-SNAPSHOT: Failed to collect dependencies at org.springframework.boot:spring-boot-starter-websocket:jar:LATEST: Failed to read artifact descriptor for org.springframework.boot:spring-boot-starter-websocket:jar:LATEST: Failed to resolve version for org.springframework.boot:spring-boot-starter-websocket:jar:LATEST: Could not find metadata org.springframework.boot:spring-boot-starter-websocket/maven-metadata.xml in local (/data/m2/repository) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] DependencyResolutionException - Apache Maven - Apache Software Foundation

3 解决方法

方法1:我进入jenkins的linux服务器中,在报错日志提示的/data/m2/repository目录下找到了具体存在的spring-boot-starter-websocket版本,并在后端项目的pom.xml文件中,将spring-boot-starter-websocket依赖的版本从LATEST改为具体存在的版本号(我的是3.3.0,你们可以去自己的服务器上看)。改好后重新构建项目,成功编译,不报错了,但这个只是权宜之计,没有从根本上解决问题。

方法2:这个报错的根本其实是jenkins本地的maven仓库没能从nexus私服仓库下载下来依赖和xml文件。发现这个问题是因为我点了jenkins构建时控制台输出的nexus仓库链接,发现是404报错。于是我又进入nexus私服仓库的linux服务器,发现nexus的java进程是运行着的,但服务停了,不知道为什么。我把进程kill掉,重新启动了nexus,所有问题解决。总结一句话就是nexus服务不知道为什么挂掉了,重启一下就解决了。。但发现这个问题还是费了些时间。

  • 22
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值