解决Maven依赖报错问题

问题现象:从svn上签下源代码,本地执行打包命令,提示如下错误:

[ERROR] Failed to execute goal on project dddwriter: Could not resolve dependencies for project com.xxx.yyy:dddwriter:jar:1.0.0: Failed to collect dependencies at com.xxx.yyy:zzzplugin:jar:1.0.0: Failed to read artifact descriptor for com.xxx.yyy:zzzplugin:jar:1.0.0: Failure to find com.xxx.yyy: aa-bb-zzz:pom:1.0.0 in http://10.10.1.5:8081/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced -> [Help 1]

分析:开始以为原因是找不到zzzplugin:jar,这个是本地的一个项目模块,可以打包成功,仔细看提示,说的是Failed to collect,并非找不到jar包。最后一个Failure to find ... 点出了根本原因,找不到  aa-bb-zzz构建,而且是线上找不到(当然首先本地没有才会去线上找),这个构建作用是提供dddwriter和zzzplugin的父pom,打包dddwriter时,因为依赖的zzzplugin没有在仓库找到此构建,所以失败。

总结:在有父pom的情况下,打包上传子构建会导致引用此构建的项目无法成功打包。

解决办法:直接打包父构建。

ps: 一开始并不是想直接打包子模块,只是因为前人将子模块的name设置的非常像父模块(应该是手误),加上在IDEA里面,父子模块是平级的,所以把它当父模块打包了,后来找出真正的父模块,一次打包成功。

猜你喜欢

转载自www.cnblogs.com/chenggang816/p/9931464.html