Maven阴影插件重叠类与依赖插件省略冲突

时间:2018-06-01 01:54:18

标签: maven dependencies

我正在使用Maven shade插件,我从mvn package获得如下输出:

[WARNING] kryo-4.0.0.jar, kryo-2.21.jar define 91 overlapping classes:

接下来是:

[WARNING] maven-shade-plugin has detected that some class files are
[WARNING] present in two or more JARs.
[WARNING] single version of the class is copied to the uber jar.
[WARNING] Usually this is not harmful and you can skip these warnings,
[WARNING] otherwise try to manually exclude artifacts based on
[WARNING] mvn dependency:tree -Ddetail=true and the above output.

另一方面,还有许多其他的罐子,我希望得到这样的警告,但我不这样做。特别是,如果我mvn dependency:tree -Dverbose,我会得到很多输出,如:

[INFO] |  |  +- (org.apache.commons:commons-lang3:jar:3.3.2:compile - omitted for conflict with 3.5)

我的问题是,为什么有些重复类只会出现“重叠类”警告,而其他情况只会导致“省略冲突”信息?

1 个答案:

答案 0 :(得分:0)

kryo的groupId从版本2.x更改为3.x.这意味着从技术上讲,kryo 4.0.0和kryo 2.21是Maven的不同工件。没有依赖关系中介,它们只是放在类路径上。这就是阴影插件抱怨的原因。