在projectName/project/目录下,新建assembly.sbt文件,添加内容:
addSbtPlugin("com.eed3si9n" % "sbt-assembly" "0.14.3")本人SBT VERSION 为0.13.15
refresh the whole project,download the plugin !
in the sbt console,execute the command:assembly
ref:
https://segmentfault.com/q/1010000003943723
https://github.com/sbt/sbt-assembly/tree/v0.14.5 (坑,一定要看最新文档)
http://www.scala-sbt.org/0.13/docs/zh-cn/Using-Plugins.html
运行assembly,出现问题:
spark + sbt-assembly: “deduplicate: different file contents found in the following”
jar包依赖冲突导致,
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 官方 英文好难读!