Skip to content

SBT (Scala Build Tool)

  • SBT is the build tool used by scala (similar to maven and gradle)
  • scala and sbt packages must be install from arch repositories
sudo pacman -S "scala"
sudo pacman -S "sbt"

Structure

  • project
  • assembly.sbt: sbt plugins
  • src
  • main
    • scala: where your source files live
  • build.sbt: dependencies and project info

Giter8 (g8)

  • Giter8 are project templates
  • Project templates contains code boilerplate to start a new project

build.sbt

name := "my-project"
version := "0.1.0-SNAPSHOT"
scalaVersion := "2.12.12"
libraryDependencies ++= Seq(
  "org.apache.spark" %% "spark-core" % "3.3.1" % "provided", // provided assumes that the dependency is pre-installed in the environment (this won't be put in the jar file). Necessary to compile the code but not to generate the jars
  "org.apache.spark" %% "spark-sql" % "3.3.1",
  "org.apache.spark" %% "spark-mllib" % "3.3.1",
  "org.apache.spark" %% "spark-streaming" % "3.3.1"
)