Skip to content

Instantly share code, notes, and snippets.

@sathish-io
Last active July 25, 2016 22:26
Show Gist options
  • Save sathish-io/44b05fe3d8e9698ae171 to your computer and use it in GitHub Desktop.
Save sathish-io/44b05fe3d8e9698ae171 to your computer and use it in GitHub Desktop.
SBT project setup tips
Run Spark Application from SBT console:
----------------------------------------
run-main -Dspark.master=local[*] com.greenline.data.spark.app.CollegeDataIndexerSparkApp
Add Eclipse plugin support:
-----------------------------
in project/plugins.sbt add,
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.5.0")
Then run 'sbt eclipse' or 'activator eclipse'
For Intellij
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0")
then run 'sbt gen-idea'
View dependencies:
------------------
in project/plugins.sbt add,
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.5")
in build.sbt add,
net.virtualvoid.sbt.graph.Plugin.graphSettings
now use 'dependency-tree' task.
Download source files for dependency:
-------------------------------------
in build.sbt add,
EclipseKeys.withSource := true
Run main method if you have multiple main:
-------------------------------------------
activator "run-main com.sathish.datagen.MainApp2"
To package app with dependencies as zip file
---------------------------------------------
activator universal:packageBin
Add below line in build.sbt file
enablePlugins(JavaAppPackaging)
Add below line in project/plugins.sbt file,
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.6")
Option#2:
Use sbt dist or sbt stage
To exclude transitive dependency:
---------------------------------
Add: exclude("org.name", "dep-name")
Example: To exclude transitive dependecy "leveldbjni-all", for "akka-stream-experimental",
libraryDependencies ++= {
Seq(
"com.typesafe.akka" %% "akka-actor" % "2.3.7",
"com.typesafe.akka" %% "akka-stream-experimental" % "0.10" exclude("org.fusesource.leveldbjni", "leveldbjni-all"),
"org.scalatest" %% "scalatest" % "2.2.1" % "test"
)
}
Create application secret for Play app:
----------------------------------------
activator playGenerateSecret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment