Structure: Build -> Projects -> Settings
-
Build
- Projects - Local or remote(git url)
- Sequence of Settings
- Setttings are Key-initialization pairs
Key is name
initialization is value or something computes value
Keys is scala Object, name is member for Keys
Example: name := "mySparkProject"
- SettingKey: name, version, organization
- TaskKey: source, compile
- InputKey: creating Task from user input
Example Build
import sbt._
import sbt.Keys._
// Project object has settings method
// organization is groupId in mavens
object MyBuild extends Build {
val mySparkProject = Project("mySparkProject", file("."))
settings (name := "mySparkProject", organization := "org.mohansun.dev" )
dependsOn (apacheSpark)
lazy val apacheSpark = RootProject(uri("git://github.com/apache/spark.git"))
}
Assignemtns
- Direct: name := "fruit"
- organization <<= name apply(n => "org.mohansun.dev"+n)
- Append (Convenience)
- libraryDependencies: +=
- libraryDependencies: ++= Seq(...)