惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
WordPress大学
WordPress大学
博客园 - 【当耐特】
Engineering at Meta
Engineering at Meta
IT之家
IT之家
Apple Machine Learning Research
Apple Machine Learning Research
小众软件
小众软件
美团技术团队
S
SegmentFault 最新的问题
The GitHub Blog
The GitHub Blog
Martin Fowler
Martin Fowler
Recorded Future
Recorded Future
H
Help Net Security
aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
博客园_首页
A
About on SuperTechFans
MongoDB | Blog
MongoDB | Blog
阮一峰的网络日志
阮一峰的网络日志
V
Visual Studio Blog
D
DataBreaches.Net
人人都是产品经理
人人都是产品经理
大猫的无限游戏
大猫的无限游戏
B
Blog
The Register - Security
The Register - Security
I
InfoQ
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
雷峰网
雷峰网
Last Week in AI
Last Week in AI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
有赞技术团队
有赞技术团队
Stack Overflow Blog
Stack Overflow Blog
Jina AI
Jina AI
Security Archives - TechRepublic
Security Archives - TechRepublic
Hacker News - Newest:
Hacker News - Newest: "LLM"
U
Unit 42
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
W
WeLiveSecurity
Latest news
Latest news
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
博客园 - 叶小钗
L
Lohrmann on Cybersecurity
博客园 - Franky
Recent Commits to openclaw:main
Recent Commits to openclaw:main
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO

博客园 - Doyourself!

rocketmq 启动后 在mq console界面的consumer的Quantity数量显示为0 问题记录 python 切换版本后 提示 无法在python 3.11(.venv)(D:/my_rag_bot/.venv/Scripts/python.exe)设置 python sdk,该sdk似乎无效 记录一次日志告警随着nacos文件动态刷新而失效的问题 多个WebMvcConfigurer配置Jackson2ObjectMapperBuilder不生效问题记录 自定义拦截器不生效问题记录 记录一次nginx能通但是请求一直不了的问题 idea远程连接并本地打包到远程服务器 记一次生产环境内存溢出记录 凤凰架构总结 sentinel接入记录 JVM虚拟机总结 记录一次首页优化的经历 使用sharding-jdbc做分库分表记录 使用druid自定义拦截器 雪花算法snowflakeIdWorker使用记录 全局调用链路traceId网关到业务层、feign调用统一问题记录 Spring Cloud 的ribbon的饥饿加载机制 打印mq异常消息记录 根据druid将慢sql通过钉钉的方式进行告警功能记录
记录一次 maven 子模块相互依赖导致的父模块无法动态升级的问题 'parent.relativePath' points at wrong local POM
Doyourself! · 2023-11-20 · via 博客园 - Doyourself!

        项目里面使用的commons公共模块,每次更改后之前都不会升级其版本号,导致当commons改动后,其他服务在不知道的情况下,会出现文件缺失。由于之前commons下面有12个公共子模块,所以之前一直没有升级commons模块。为了方便,于是决定每次更改commons模块后让所有的子项目都跟着升级。

      但是改造的过程中,出现了问题。 

<groupId>com.gwm.marketing</groupId>
    <artifactId>gwm-marketing-commons</artifactId>
    <version>${commons.version}</version>

    <packaging>pom</packaging>

    <properties>
        <commons.version>1.0.1-SNAPSHOT</commons.version>
    </properties>

 这个是我在父模块中的定义,然后在子模块中如下:

 <parent>
        <groupId>com.gwm.marketing</groupId>
        <artifactId>gwm-marketing-commons</artifactId>
        <version>${commons.version}</version>
        
    </parent>

结果在编译时候报错如下:

[2023-11-20 15:03:03] [ERROR] The build could not read 12 projects -> [Help 1]
[2023-11-20 15:03:03] [ERROR]   
[2023-11-20 15:03:03] [ERROR]   The project com.gwm.marketing:gwm-marketing-cache:${commons.version} (/root/workspace/gwm-marketing-cache/pom.xml) has 1 error
[2023-11-20 15:03:03] [ERROR]     Non-resolvable parent POM for com.gwm.marketing:gwm-marketing-cache:${commons.version}: Could not find artifact com.gwm.marketing:gwm-marketing-commons:pom:${commons.version} in gwm-maven (https://gwmdc-maven.pkg.coding.net/repository/gwm-boot/gwm-maven) and 'parent.relativePath' points at wrong local POM @ line 5, column 13 -> [Help 2]
[2023-11-20 15:03:03] [ERROR]   
[2023-11-20 15:03:03] [ERROR]   The project com.gwm.marketing:gwm-marketing-common:${commons.version} (/root/workspace/gwm-marketing-common/pom.xml) has 1 error
[2023-11-20 15:03:03] [ERROR]     Non-resolvable parent POM for com.gwm.marketing:gwm-marketing-common:${commons.version}: Failure to find com.gwm.marketing:gwm-marketing-commons:pom:${commons.version} in https://gwmdc-maven.pkg.coding.net/repository/gwm-boot/gwm-maven was cached in the local repository, resolution will not be reattempted until the update interval of gwm-maven has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 5, column 13 -> [Help 2]
[2023-11-20 15:03:03] [ERROR]   
[2023-11-20 15:03:03] [ERROR]   The project com.gwm.marketing:gwm-marketing-feign:${commons.version} (/root/workspace/gwm-marketing-feign/pom.xml) has 1 error
[2023-11-20 15:03:03] [ERROR]     Non-resolvable parent POM for com.gwm.marketing:gwm-marketing-feign:${commons.version}: Failure to find com.gwm.marketing:gwm-marketing-commons:pom:${commons.version} in https://gwmdc-maven.pkg.coding.net/repository/gwm-boot/gwm-maven was cached in the local repository, resolution will not be reattempted until the update interval of gwm-maven has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 9, column 13 -> [Help 2]

12个子模块,刚好对应  The build could not read 12 projects - ,由报错信息可以知道,是因为 我在父模块中定义的公共属性 ${commons.version}  在子模块中找不到,所有的子模块我用的都是一个公共配置,这样每次改动升级commons版本后,只需要父模块升级一下,然后引入的地方对应改动下即可。思路是没问题的,但是怎么就报错了呢?

      网上显示搜索了下,参考(https://blog.csdn.net/q7w8e9r4/article/details/133639219、https://blog.csdn.net/rightkk/article/details/128856354) 发现是说 在子模块配置中缺少 

<relativePath></relativePath> 的配置,
于是我把所有的子模块都加上这个,子模块配置如下:
    <parent>
        <groupId>com.gwm.marketing</groupId>
        <artifactId>gwm-marketing-commons</artifactId>
        <version>${commons.version}</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

结果仍然是报错。

    这时候想了下,会不会是我子模块中原来写的 模块有相互依赖是写死的导致的,原来的12个子模块中,历史的原因,存在相互依赖的引用关系,之前的依赖都是写死的,于是把原来写死的 统一都改成 ${commons.version}。发现就可以了。。

另外我试下了:在子模块中使用 

        <relativePath>../pom.xml</relativePath>

   和 

<relativePath>../../gwm-marketing-commons/pom.xml</relativePath> 的结果竟然是不一致,按照我的理解,.../../gwm-marketing-commons/pom.xml 和 直接使用../pom.xml应该都是一样的才对,因为都是相对路径,可是实际结果是 只有 

        <relativePath>../pom.xml</relativePath>

  才可以。

 总结下来,有两个原因:首先是 缺少 

        <relativePath>../pom.xml</relativePath>

 第二个是之前的子模块存在相互依赖,需要把相互依赖的版本也同意修改下才行