SBT 配置依赖打包

前端之家收集整理的这篇文章主要介绍了SBT 配置依赖打包前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

在projectName/project/目录下,新建assembly.sbt文件添加内容

addSbtPlugin("com.eed3si9n" % "sbt-assembly" "0.14.3")
本人SBT VERSION 为0.13.15


@H_301_37@refresh the whole project,download the plugin !

@H_301_37@

@H_301_37@in the sbt console,execute the command:assembly

@H_301_37@ref:

@H_301_37@ https://segmentfault.com/q/1010000003943723

@H_301_37@ https://github.com/sbt/sbt-assembly/tree/v0.14.5 (坑,一定要看最新文档)

@H_301_37@ http://www.scala-sbt.org/0.13/docs/zh-cn/Using-Plugins.html

@H_301_37@运行assembly,出现问题:

spark + sbt-assembly: “deduplicate: different file contents found in the following”

jar包依赖冲突导致,
解决办法:在build.sbt文件添加如下:

assemblyMergeStrategy in assembly := {
    case PathList("javax","servlet",xs @ _*) => MergeStrategy.last
    case PathList("javax","activation",xs @ _*) => MergeStrategy.last
    case PathList("org","apache",xs @ _*) => MergeStrategy.last
    case PathList("com","google","esotericsoftware","codahale","yammer",xs @ _*) => MergeStrategy.last
    case "about.html" => MergeStrategy.rename
    case "Meta-INF/ECLIPSEF.RSA" => MergeStrategy.last
    case "Meta-INF/mailcap" => MergeStrategy.last
    case "Meta-INF/mimetypes.default" => MergeStrategy.last
    case "plugin.properties" => MergeStrategy.last
    case "log4j.properties" => MergeStrategy.last
    case x =>
        val oldStrategy = (assemblyMergeStrategy in assembly).value
        oldStrategy(x)
}
引用:https://stackoverflow.com/questions/30446984/spark-sbt-assembly-deduplicate-different-file-contents-found-in-the-followi

http://blog.csdn.net/oopsoom/article/details/41318599 写的很好,总结很到位!

https://github.com/sbt/sbt-assembly#merge-strategy 官方 英文好难读!
原文链接:https://www.f2er.com/javaschema/282866.html

猜你在找的设计模式相关文章