私は私のスパークプログラムはこれをやって展開することができますので、ユーバーjarを構築しようとしています:スパーク2のsbtアセンブリの重複除外エラースカラ座2.11.8
ラン:
sbt assembly
これは、エラーの多くを出力し:Scalaの2.10に関連する質問に対する
[error] deduplicate: different file contents found in the following:
[error] /Users/samibadawi/.ivy2/cache/commons-collections/commons-collections/jars/commons-collections-3.2.1.jar:org/apache/commons/collections/FastHashMap$CollectionView$CollectionViewIterator.class
[error] /Users/samibadawi/.ivy2/cache/commons-beanutils/commons-beanutils/jars/commons-beanutils-1.7.0.jar:org/apache/commons/collections/FastHashMap$CollectionView$CollectionViewIterator.class
答えは動作しませんでした: spark + sbt-assembly: "deduplicate: different file contents found in the following"
多くのハッキングの後、私は以下のbuild.sbtファイルを使ってコンパイルするのに便利なコードがなくても、hello worldプロジェクトを手に入れました:
これは無作為なもので、マージ戦略に入ります。これを行うための体系的な方法がもっと簡単ですか?
(使用に加え: "org.apache.spark" %% "火花コア" %のsparkVersion% "を提供"、全く展開の依存関係が存在しないその場合 。)
build.sbtの抜粋:
import sbtassembly.AssemblyPlugin._
//Define dependencies. These ones are only required for Test and Integration Test scopes.
libraryDependencies ++= Seq(
("org.apache.spark" %% "spark-core" % sparkVersion).
exclude("commons-beanutils", "commons-beanutils-core").
exclude("commons-collections", "commons-collections").
exclude("commons-logging", "commons-logging").
exclude("com.esotericsoftware.minlog", "minlog").
exclude("com.codahale.metrics", "metrics-core").
exclude("aopalliance","aopalliance")
,
"org.scalatest" %% "scalatest" % "2.2.4" % "test,it"
)
mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
{
case PathList("javax", "servlet", xs @ _*) => MergeStrategy.last
case PathList("javax", "inject", xs @ _*) => MergeStrategy.last
case PathList("javax", "activation", xs @ _*) => MergeStrategy.last
case PathList("org", "apache", xs @ _*) => MergeStrategy.last
case PathList("com", "google", xs @ _*) => MergeStrategy.last
case PathList("com", "esotericsoftware", xs @ _*) => MergeStrategy.last
case PathList("com", "codahale", xs @ _*) => MergeStrategy.last
case PathList("com", "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 => old(x)
}
}
Project.inConfig(Test)(assemblySettings)