Could not resolve dependencies for project com.xxx:xxx-service:jar:2.0.0

本文探讨了Maven多模块项目中遇到的依赖问题,特别是当子项目依赖未发布的父项目版本时出现的错误。文章提供了解决方案,包括确保从父项目的目录运行mvn install命令。

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

Maven多模块项目jar包引用问题:

Failed to execute goal on project xxx-service: Could not resolve dependencies for project com.xxx:xxx-service:jar:2.0.0: Failed to collect dependencies at com.yyy:yyy-facade:jar:1.0.0: Failed to read artifact descriptor for com.yyy:yyy-facade:jar:2.0.0: Failure to find com.yyy:yyy:pom:2.0.0 in was cached in the local repository, resolution will not be reattempted until the update interval of test-mirrorId has elapsed or updates are forced

这个是项目中出现的一个问题,多组件的项目,统一进行了版本升级,但是都没有进行发布(maven deploy),因此私服上面没有最新的jar包,只要出现有依赖的组件jar包(一般是接口层),就会导致发布失败。于是在就先直接把接口层进行打包发布。此时私服上面已经有了最新的版本包,但是其他组件在发布时还是报了了这个错。这是没有先把父pom进行打包,
  可参考SF:https://stackoverflow.com/questions/6642146/maven-failed-to-read-artifact-descriptor。

This problem can occur if you have some child projects that refer to a parent pom and you have not installed from the parent pom directory (run mvn install from the parent directory). One of the child projects may depend on a sibling project and when it goes to read the pom of the sibling, it will fail with the error mentioned in the question unless you have installed from the parent pom directory at least once.

大致意思:如果你有子项目引用了父项目的POM,但没有在父项目POM目录下执行安装操作(父目录下执行mvn install),这个问题就会出现。当一个子模块可能会依赖一个兄弟子模块而且去读取兄弟子模块的pom时,除非在父项目POM目录下至少执行一次安装,否则就会读取失败,即出现上述错误。

参考 : https://www.cnblogs.com/wpbxin/p/9715114.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值