Maven传递依赖 无法引入解决办法

今天一个传递依赖问题搞了我半天,终于搞明白原因了。项目引入uecom-core.jar,uecom-core包A依赖了oshi-core,在IDEA里面只能看到依赖uecom-core,不管咋样都看不到依赖的oshi-core。

我在IDEA里打包后在控制台发现一个告警:

The POM for top.uecom:uecom-core:jar:1.1.3 is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while building the effective model for top.uecom:uecom-core:1.1.3

原来是uecom-core.jar的pom依赖有问题。

问题排查

在项目根目录打印依赖树:

mvn dependency:tree>tree.txt

应用依赖树中出现警告。警告显示:应用引入的依赖包无效,依赖包中传递依赖项不可用,可以通过开启debug获取更多信息。

然后我开启debug功能,重新打印依赖树:

mvn -X dependency:tree>tree.txt

开启maven debug功能后,警告后紧跟了一条错误信息,如下

[WARNING] The POM for top.uecom:uecom-core:jar:1.1.3 is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while building the effective model for top.uecom:uecom-core:1.1.3
[ERROR] 'dependencies.dependency.version' for cn.hutool:hutool-all:jar is missing. @ 
...

原来是uecom-core:jar包中引入的hutool-all无法获取版本号。

解决方案

在hutool-all中加上版本号重新发布,则一切正常。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值