maven项目jar包版本错误:‘dependencies.dependency.version‘ for xxx:jar is missing. @ line xx, column xx

在Maven项目中遇到子项目依赖版本缺失的错误,问题出在父项目pom.xml的依赖管理部分缺少指定版本号。通过添加`<dependencyManagement>`标签并正确配置依赖版本,可以实现父项目统一管理所有子项目的依赖版本,从而避免子项目中重复声明。修复此问题后,子项目将正确加载依赖,避免版本冲突。

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

maven项目jar包版本错误:‘dependencies.dependency.version’ for xxx:jar is missing. @ line xx, column xx

[ERROR]   The project XXX (/home/×××/pom.xml) has 1 error
[ERROR]     ‘dependencies.dependency.version’ for xxx:jar is missing. @ line xx, column xx
maven项目中
父项目的pom.xml通过
    
        XXX
      
将子项目载入
子项目中的pom.xml通过
 
        YYY
        com.ZZZ
        1.0.0
    
配置父项目
那么可以只在父项目的pom.xml定义所需依赖的jar包的版本即可,子项目只需要简单引用
但是尝试多次,子项目加载时总是报如上缺少jar包版本信息的错误

折腾了很久发现是在设置父项目的依赖jar包时外层少加了这个依赖版本管理的标签
————————————————
版权声明:本文为CSDN博主「ikingden」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/Nazir2513/article/details/44237957

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
[WARNING] 'dependencyManagement.dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: cn.dev33:sa-token-dao-redis-jackson:jar -> duplicate declaration of version 1.33.0 @ com.jian:ji_an_riding_master:1.0.0-SNAPSHOT, D:\develop\TaiYangGongShe_v2\ji_an_riding_master\pom.xml, line 205, column 25 [WARNING] 'dependencyManagement.dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: com.alibaba:easyexcel:jar -> version 3.1.1 vs 3.0.5 @ com.jian:ji_an_riding_master:1.0.0-SNAPSHOT, D:\develop\TaiYangGongShe_v2\ji_an_riding_master\pom.xml, line 211, column 25 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] [INFO] --------------------------< com.jian:manage >--------------------------- [INFO] Building 后端管理模块 1.0.0-SNAPSHOT [INFO] from pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [WARNING] The POM for com.jian:service:jar:1.0.0-SNAPSHOT is missing, no dependency information available [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.484 s [INFO] Finished at: 2025-03-24T16:19:02+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal on project manage: Could not resolve dependencies for project com.jian:manage:jar:1.0.0-SNAPSHOT [ERROR] dependency: com.jian:service:jar:1.0.0-SNAPSHOT (compile) [ERROR] Could not find artifact com.jian:service:jar:1.0.0-SNAPSHOT [ERROR] [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For m
最新发布
03-25
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

和你在一起^_^

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

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

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

打赏作者

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

抵扣说明:

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

余额充值