子pom排除父pom的jar包_反正有没有排除从父POM继承的工件?

Artifacts from dependencies can be excluded by declaring an element inside a But in this case it's needed to exclude an artifact inherited from a parent project. An excerpt of the POM under discussion follows:

4.0.0

test

jruby

0.0.1-SNAPSHOT

base

es.uniovi.innova

1.0.0

com.liferay.portal

ALL-DEPS

1.0

provided

pom

base artifact, depends on javax.mail:mail-1.4.jar, and ALL-DEPS depends on another version of the same library. Due to the fact that mail.jar from ALL-DEPS exist on the execution environment, although not exported, collides with the mail.jar that exists on the parent, which is scoped as compile.

A solution could be to rid off mail.jar from the parent POM, but most of the projects that inherit base, need it (as is a transtive dependency for log4j). So What I would like to do is to simply exclude parent's library from the child project, as it could be done if base was a dependency and not the parent pom:

...

base

es.uniovi.innova

1.0.0

pom

javax.mail

mail

...

解决方案

Some ideas:

Maybe you could simply not inherit from the parent in that case (and declare a dependency on base with the exclusion). Not handy if you have lot of stuff in the parent pom.

Another thing to test would be to declare the mail artifact with the version required by ALL-DEPS under the dependencyManagement in the parent pom to force the convergence (although I'm not sure this will solve the scoping problem).

javax.mail

mail

???

Or you could exclude the mail dependency from log4j if you're not using the features relying on it (and this is what I would do):

log4j

log4j

1.2.15

provided

javax.mail

mail

javax.jms

jms

com.sun.jdmk

jmxtools

com.sun.jmx

jmxri

Or you could revert to the version 1.2.14 of log4j instead of the heretic 1.2.15 version (why didn't they mark the above dependencies as optional?!).

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值