Maven打包找不到父目录pom文件

异常信息:

[FATAL] Non-resolvable parent POM for xxxxx: Failure to transfer xxxxxx from xxxxxxxxxxxx was cached in the local repository, resolution will not be reattempted until the update interval of nexus-snapshots has elapsed or updates are forced. Original error: Could not transfer artifact xxxxxxxxxx from/to nexus-snapshots (xxxxxxxxx): Transfer failed for xxxxxx 400 Repository version policy: SNAPSHOT does not allow version: 0.20.3 and 'parent.relativePath' points at wrong local POM @ line 5, column 13

网上看很多都把矛头指向parent.relativePath,这里异常提示的也是parent.relativePath问题,然后就会陷入怀疑人生的搜索和parent.relativePath相关的词条。

当然,首先检查的是parent.relativePath是否真的配错,如果parent.relativePath没有配错,并且gourpId,artifactId,version都没问题,同时,编译还会去远程仓库拉取父pom,笔者遇到的问题出现在一次修改groupId的过程中,所以远程仓库是找不到父pom的,这个时候就会怀疑人生了,按道理是优先从本地文件系统查找父pom,然后是local repository,最后是remote repository。这个时候自然想到的就是install父pom,但是,install的时候依然报了同样的错误,试了各种方法依旧不灵,最后偶然的发现报错的子pom数量并非等于所有的子pom数,于是,对比所有子pom的parent节点发现,version存在差异,没问题的version通过${version}引用的父pom中的properties,有问题的version直接写死的具体版本号,两种写法的具体version值是一致的,通过反复试验发现,结论是:子pom里面parent.version必须与父pom里面的version写法一致,笔者项目内的父pom version引用的${version},所有相同写法的子pom编译没问题。

要么都用${version},要么都直接写死 2.0.3 不能混用

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

刘个Java

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值