++++++++++++++++++++++++++++++++++++++++++++++++++
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.13.0")
2. Build.sbt file
+++++++++++++++++++++++++++++++++++++++++++++++++++
lazy val commonSettings = Seq( name := "myproject", version := "1.0", organization := "com.company" ) scalaVersion := "2.11.0" lazy val app = (project in file("app"))
.settings(commonSettings: _*)
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % "1.3.0",
"junit" % "junit" % "4.12" % "test",
"org.scalatest" %% "scalatest" % "2.2.4" % "test",
"org.apache.spark" %% "spark-mllib" % "1.3.0",
"org.apache.spark" %% "spark-sql" % "1.3.0",
"org.apache.spark" %% "spark-streaming" % "1.3.0",
// Joda dates for Scala
"com.github.nscala-time" %% "nscala-time" % "1.8.0"
)
//import the external jars
unmanagedBase := baseDirectory.value / "lib"
javaOptions += "-Xmx2G"
resolvers ++= Seq(
"Akka Repository" at "http://repo.akka.io/releases/",
"Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/"
)
//assembly merge strategy settings
assemblyMergeStrategy in assembly := {
case n if n.startsWith("META-INF/eclipse.inf") => MergeStrategy.discard
case n if n.startsWith("META-INF/ECLIPSEF.RSA") => MergeStrategy.discard
case n if n.startsWith("META-INF/ECLIPSE_.RSA") => MergeStrategy.discard
case n if n.startsWith("META-INF/ECLIPSEF.SF") => MergeStrategy.discard
case n if n.startsWith("META-INF/ECLIPSE_.SF") => MergeStrategy.discard
case n if n.startsWith("META-INF/MANIFEST.MF") => MergeStrategy.discard
case n if n.startsWith("META-INF/NOTICE.txt") => MergeStrategy.discard
case n if n.startsWith("META-INF/NOTICE") => MergeStrategy.discard
case n if n.startsWith("META-INF/LICENSE.txt") => MergeStrategy.discard
case n if n.startsWith("META-INF/LICENSE") => MergeStrategy.discard
case n if n.startsWith("rootdoc.txt") => MergeStrategy.discard
case n if n.startsWith("readme.html") => MergeStrategy.discard
case n if n.startsWith("readme.txt") => MergeStrategy.discard
case n if n.startsWith("library.properties") => MergeStrategy.discard
case n if n.startsWith("license.html") => MergeStrategy.discard
case n if n.startsWith("about.html") => MergeStrategy.discard
case _ => MergeStrategy.last
}
//give a name to generated jar
assemblyJarName in assembly :="woody_law_v1.jar"
//set an explicit main class
mainClass in assembly := Some("com.paytmlabs.fraud.FraudApp")
//skip the test during assembly
test in assembly := {}
scalacOptions ++= Seq("-unchecked", "-deprecation")
Reference:
https://github.com/jayunit100/SparkStreamingApps/blob/master/build.sbt
https://suvirjain.com/getting-scala-spark-working-with-intellij-ide/
https://github.com/sbt/sbt-assembly
No comments:
Post a Comment