子pom排除父pom的jar包_子pom可以继承父pom中定义的依赖项排除吗?

I'm not sure if this is support by Maven or not. I appreciate any help I can get.

I have a parent pom that defines a dependency and an exclusion. I can't change the parent pom:

foo

bar

1.0

org.springframework.cloud

spring-cloud-config-server

Then in the child pom, I have a need to exclude a different dependency from that same dependency in the parent. Like so

foo

bar

1.0

org.slf4j

slf4j-log4j12

But if I do that, the child will have the slf4j jar excluded (correctly), but it will NOT have the spring-cloud-config-server jar excluded, unless if I restate the parent exclusion in the child declaration of that dependency.

I realize I could just copy it, but that's messy, and I realize that it would be easy to push the child's exclusion up to the parent, but then I'd be forcing that exclusion on all the other children.

What I'd like is for Maven to merge the dependency exclusion information when the same dependency is declared differently in the parent and child.

Is that possible?

解决方案

In your parent pom:

foo

bar

1.0

org.springframework.cloud

spring-cloud-config-server

In your child pom:

foo

bar

org.slf4j

slf4j-log4j12

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值