• 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编译没问题。

  • 相关阅读:
    ORACLE SEQUENCE 介绍
    cocos2d 游戏开发:Cocos2d v3 "hello world"+显示飞船
    无线网络覆盖
    解决xShell4某些情况下按删除键会输出^H的问题
    Android开发经验之—intent传递大数据
    简单的REST的框架实现
    ListView 使用方法(Asp.Net)
    POJ2528 Mayor's posters 【线段树】+【成段更新】+【离散化】
    C#反射Assembly 具体说明
    HDU 4432 Sum of divisors (进制模拟)
  • 原文地址:https://www.cnblogs.com/reboot30/p/15717413.html
Copyright © 2020-2023  润新知