【发布时间】:2018-10-19 08:41:20
【问题描述】:
标题也可以是:
Maven和SBT组装插件有什么区别。
在将项目从 Maven 迁移到 SBT 时,我发现这是一个问题。
为了描述问题,我创建了一个示例项目,其中包含我发现行为不同的依赖项,具体取决于构建工具。
https://github.com/atais/mvn-sbt-assembly
唯一的依赖是(sbt风格)
"com.netflix.astyanax" % "astyanax-cassandra" % "3.9.0",
"org.apache.cassandra" % "cassandra-all" % "3.4",
而我不明白的是,为什么mvn package 成功创建了胖罐,而sbt assembly 给出了冲突:
[error] 39 errors were encountered during merge
[error] java.lang.RuntimeException: deduplicate: different file contents found in the following:
[error] /home/siatkowskim/.ivy2/cache/org.slf4j/jcl-over-slf4j/jars/jcl-over-slf4j-1.7.7.jar:org/apache/commons/logging/<some classes>
[error] /home/siatkowskim/.ivy2/cache/commons-logging/commons-logging/jars/commons-logging-1.1.1.jar:org/apache/commons/logging/<some classes>
...
[error] /home/siatkowskim/.ivy2/cache/com.github.stephenc.high-scale-lib/high-scale-lib/jars/high-scale-lib-1.1.2.jar:org/cliffc/high_scale_lib/<some classes>
[error] /home/siatkowskim/.ivy2/cache/com.boundary/high-scale-lib/jars/high-scale-lib-1.0.6.jar:org/cliffc/high_scale_lib/<some classes>
...
【问题讨论】:
-
@TarunLalwani 你的最后一个链接(文章)很好地描述了这个案例,但问题是,如果发生冲突,他们推荐
maven-shade-plugin。这就是事情变得有趣的地方。因为在我的示例项目中,存在冲突,但不知何故maven-assembly-plugin解决了它们,而sbt-assembly没有。 -
我试图找到任何相同的参考,但我没有找到任何描述 maven shade 插件如何做到这一点的东西
-
sbt-assembly 也可以做阴影:github.com/sbt/sbt-assembly#shading
-
真是巧合,我也遇到了这个问题,花了一个多星期的时间试图弄清楚。很高兴你问了这个问题。
标签: maven sbt maven-3 maven-assembly-plugin sbt-assembly