SlideShare a Scribd company logo
1 of 23
sbt
And all that jazz
Building scala/Java projects
• Option #1: scalac/javac
scalac HelloWorld.scala // outputs .class files
• Option #2: build system
• Ant (old and lame)
• Maven (too much XML)
• Ivy (limited)
• sbt (powerful)
End result
• .class files contain bytecode (directory structure <-> packages)
• .jar files are zipped up .class files
• MANIFEST files can specify the main class in a .jar
• run with java jar yourfile.jar
Maven – the bad part
Maven – the good parts
• Source code structure:
• src
• main
• java
• com/adform/dspr
• Processor.Java
• test
• java
• com/adform/dsrp
• ProcessorTest.Java
• target
• pom.xml
• README.md
Ivy/Maven – the good parts
• Dependency management
<dependency>
<groupId>com.twitter</groupId>
<artifactId>scalding-core_2.9.2</artifactId>
<version>0.8.4</version>
</dependency>
• Libraries make graphs of dependencies
• JARs are published to repositories ( http://search.maven.org/ )
• Maven resolves/downloads everything!
Library dependencies
sbt
• Simple (haha!) Build Tool
• Can compile both Java and Scala projects
• Build definitions are scala programs
• Uses Ivy dependency management
sbt – project layout
• src
• main
• scala
• com/adform/dspr
• Processor.scala
• test
• scala
• com/adform/dsrp
• ProcessorTest.scala
• target
• project
• target
• Build.scala
• plugins.sbt
• build.properties
• build.sbt
• version.sbt
• README.md
Minimal build.sbt
organization := "com.adform.dspr"
name := "vertica-udfs"
scalaVersion := "2.11.2"
resolvers ++= Seq(
"Concurrent Maven Repo" at "http://conjars.org/repo",
)
libraryDependencies ++= Seq(
"io.argonaut" % "argonaut_2.10" % "6.0.4"
)
Usage
• sbt test/compile/run/package
• sbt ~compile/~test
• sbt
reload
compile
run
Some (very simplified) Theory
• A build is a Seq[Setting[T]]
• A Setting[T] is either a property or a Task
• e.g. name = SettingKey[String]("name", "Project name.")
• e.g. compile = TaskKey[Analysis]("compile", "Compiles sources.")
• A build definition transforms the Settings
• e.g. name := "vertica-udfs” [def :=(v: T): Setting[T]]
Some (very simplified) Theory
• You can define your own tasks/settings
• e.g.
• lazy val hello = taskKey[Unit]("An example task")
• hello := { println("Hello!") }
• sbt hello
• Settings/Tasks have scopes
• e.g. name in Compile := "hello"
Some (very simplified) Theory
• Settings can also be modified with other operators:
• libraryDependencies ++= Seq(…)
• resolvers += “Repository” at “http://repo.lt/”
• publishTo <<= version { v => “repository/” + v }
More details
• A build consists of project/*.scala + *.sbt files
• Sample project/Build.scala:
import sbt._
import Keys._
object HelloBuild extends Build {
val sampleKeyB = settingKey[String]("demo key B")
lazy val root = Project(id = "hello",
base = file("."),
settings = Seq(
sampleKeyB := "B: in the root project settings in Build.scala"
))
}
More details
• .scala builds useful for multi-project builds
• Also useful for shared code across .sbt files
• .sbt take precedence over project/.scala!
• project/build.properties used to specify sbt version
Plot twist!
• How do you build the build project ?
Plot twist!
• How do you build the build project ?
• With sbt!
• project is the root folder of the build application
• plugins.sbt is the definition of the build of the build!
Plugins
• They are just library dependencies for the build project!
• Useful plugins: assembly, dependency-graph
• http://www.scala-sbt.org/0.13/docs/Community-Plugins.html
Library dependencies
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "2.2.2" % "test“
)
%% === % “scalatest_2.10”
% “test” === use only in test scope
Library dependencies
resolvers ++= Seq(
"Twitter Maven" at "http://maven.twttr.com",
"Adform Repo" at "http://ec2-54-74-8-112.eu-west-1.compute.amazonaws.com/repository/releases“
)
Dependencies are also cached in ~/.ivy2 – clear cache if something is off!
DEMO TIME !!!
QUESTIONS !!?!11

More Related Content

What's hot

Content Management With Apache Jackrabbit
Content Management With Apache JackrabbitContent Management With Apache Jackrabbit
Content Management With Apache Jackrabbit
Jukka Zitting
 
CQ5 QueryBuilder - .adaptTo(Berlin) 2011
CQ5 QueryBuilder - .adaptTo(Berlin) 2011CQ5 QueryBuilder - .adaptTo(Berlin) 2011
CQ5 QueryBuilder - .adaptTo(Berlin) 2011
Alexander Klimetschek
 
Using ActiveObjects in Atlassian Plugins
Using ActiveObjects in Atlassian PluginsUsing ActiveObjects in Atlassian Plugins
Using ActiveObjects in Atlassian Plugins
Atlassian
 
Build Your Own CMS with Apache Sling
Build Your Own CMS with Apache SlingBuild Your Own CMS with Apache Sling
Build Your Own CMS with Apache Sling
Bob Paulin
 
Rubyonrails 090715105949-phpapp01
Rubyonrails 090715105949-phpapp01Rubyonrails 090715105949-phpapp01
Rubyonrails 090715105949-phpapp01
sagaroceanic11
 

What's hot (20)

Introduction to Apache Ant
Introduction to Apache AntIntroduction to Apache Ant
Introduction to Apache Ant
 
Play framework
Play frameworkPlay framework
Play framework
 
Maven
Maven Maven
Maven
 
Rails 3 (beta) Roundup
Rails 3 (beta) RoundupRails 3 (beta) Roundup
Rails 3 (beta) Roundup
 
Play Framework and Activator
Play Framework and ActivatorPlay Framework and Activator
Play Framework and Activator
 
Content Management With Apache Jackrabbit
Content Management With Apache JackrabbitContent Management With Apache Jackrabbit
Content Management With Apache Jackrabbit
 
Java goes wild, lesson 1
Java goes wild, lesson 1Java goes wild, lesson 1
Java goes wild, lesson 1
 
CQ5 QueryBuilder - .adaptTo(Berlin) 2011
CQ5 QueryBuilder - .adaptTo(Berlin) 2011CQ5 QueryBuilder - .adaptTo(Berlin) 2011
CQ5 QueryBuilder - .adaptTo(Berlin) 2011
 
Play framework productivity formula
Play framework   productivity formula Play framework   productivity formula
Play framework productivity formula
 
Play! Framework for JavaEE Developers
Play! Framework for JavaEE DevelopersPlay! Framework for JavaEE Developers
Play! Framework for JavaEE Developers
 
Designing a play framework application
Designing a play framework applicationDesigning a play framework application
Designing a play framework application
 
Using ActiveObjects in Atlassian Plugins
Using ActiveObjects in Atlassian PluginsUsing ActiveObjects in Atlassian Plugins
Using ActiveObjects in Atlassian Plugins
 
Flexible search in Apache Jackrabbit Oak
Flexible search in Apache Jackrabbit OakFlexible search in Apache Jackrabbit Oak
Flexible search in Apache Jackrabbit Oak
 
Preparing for java 9 modules upload
Preparing for java 9 modules uploadPreparing for java 9 modules upload
Preparing for java 9 modules upload
 
All your data belong to us - The Active Objects Plugin
All your data belong to us - The Active Objects PluginAll your data belong to us - The Active Objects Plugin
All your data belong to us - The Active Objects Plugin
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
Build Your Own CMS with Apache Sling
Build Your Own CMS with Apache SlingBuild Your Own CMS with Apache Sling
Build Your Own CMS with Apache Sling
 
Rubyonrails 090715105949-phpapp01
Rubyonrails 090715105949-phpapp01Rubyonrails 090715105949-phpapp01
Rubyonrails 090715105949-phpapp01
 
Node.js Development with Apache NetBeans
Node.js Development with Apache NetBeansNode.js Development with Apache NetBeans
Node.js Development with Apache NetBeans
 
JCR In Action (ApacheCon US 2009)
JCR In Action (ApacheCon US 2009)JCR In Action (ApacheCon US 2009)
JCR In Action (ApacheCon US 2009)
 

Similar to SBT by Aform Research, Saulius Valatka

How to start using Scala
How to start using ScalaHow to start using Scala
How to start using Scala
Ngoc Dao
 

Similar to SBT by Aform Research, Saulius Valatka (20)

An introduction to maven gradle and sbt
An introduction to maven gradle and sbtAn introduction to maven gradle and sbt
An introduction to maven gradle and sbt
 
How to start using Scala
How to start using ScalaHow to start using Scala
How to start using Scala
 
Maven in Mule
Maven in MuleMaven in Mule
Maven in Mule
 
Maven
MavenMaven
Maven
 
Maven introduction in Mule
Maven introduction in MuleMaven introduction in Mule
Maven introduction in Mule
 
Maven
MavenMaven
Maven
 
Gradle
GradleGradle
Gradle
 
Introduction tomaven
Introduction tomavenIntroduction tomaven
Introduction tomaven
 
Cis 274 intro
Cis 274   introCis 274   intro
Cis 274 intro
 
Apache Maven
Apache MavenApache Maven
Apache Maven
 
Intro to-ant
Intro to-antIntro to-ant
Intro to-ant
 
Build Automation of PHP Applications
Build Automation of PHP ApplicationsBuild Automation of PHP Applications
Build Automation of PHP Applications
 
Maven
MavenMaven
Maven
 
Maven
MavenMaven
Maven
 
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...
 
Training in Android with Maven
Training in Android with MavenTraining in Android with Maven
Training in Android with Maven
 
Sbt, idea and eclipse
Sbt, idea and eclipseSbt, idea and eclipse
Sbt, idea and eclipse
 
Apache Maven basics
Apache Maven basicsApache Maven basics
Apache Maven basics
 
Buildr In Action @devoxx france 2012
Buildr In Action @devoxx france 2012Buildr In Action @devoxx france 2012
Buildr In Action @devoxx france 2012
 
SBT Concepts, part 2
SBT Concepts, part 2SBT Concepts, part 2
SBT Concepts, part 2
 

More from Vasil Remeniuk

Spark Intro by Adform Research
Spark Intro by Adform ResearchSpark Intro by Adform Research
Spark Intro by Adform Research
Vasil Remeniuk
 
Types by Adform Research, Saulius Valatka
Types by Adform Research, Saulius ValatkaTypes by Adform Research, Saulius Valatka
Types by Adform Research, Saulius Valatka
Vasil Remeniuk
 
Types by Adform Research
Types by Adform ResearchTypes by Adform Research
Types by Adform Research
Vasil Remeniuk
 
Scalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex GryzlovScalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex Gryzlov
Vasil Remeniuk
 
Scalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex GryzlovScalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex Gryzlov
Vasil Remeniuk
 
Spark by Adform Research, Paulius
Spark by Adform Research, PauliusSpark by Adform Research, Paulius
Spark by Adform Research, Paulius
Vasil Remeniuk
 
Scala Style by Adform Research (Saulius Valatka)
Scala Style by Adform Research (Saulius Valatka)Scala Style by Adform Research (Saulius Valatka)
Scala Style by Adform Research (Saulius Valatka)
Vasil Remeniuk
 
Spark intro by Adform Research
Spark intro by Adform ResearchSpark intro by Adform Research
Spark intro by Adform Research
Vasil Remeniuk
 

More from Vasil Remeniuk (20)

Product Minsk - РТБ и Программатик
Product Minsk - РТБ и ПрограмматикProduct Minsk - РТБ и Программатик
Product Minsk - РТБ и Программатик
 
Работа с Akka Сluster, @afiskon, scalaby#14
Работа с Akka Сluster, @afiskon, scalaby#14Работа с Akka Сluster, @afiskon, scalaby#14
Работа с Akka Сluster, @afiskon, scalaby#14
 
Cake pattern. Presentation by Alex Famin at scalaby#14
Cake pattern. Presentation by Alex Famin at scalaby#14Cake pattern. Presentation by Alex Famin at scalaby#14
Cake pattern. Presentation by Alex Famin at scalaby#14
 
Scala laboratory: Globus. iteration #3
Scala laboratory: Globus. iteration #3Scala laboratory: Globus. iteration #3
Scala laboratory: Globus. iteration #3
 
Testing in Scala by Adform research
Testing in Scala by Adform researchTesting in Scala by Adform research
Testing in Scala by Adform research
 
Spark Intro by Adform Research
Spark Intro by Adform ResearchSpark Intro by Adform Research
Spark Intro by Adform Research
 
Types by Adform Research, Saulius Valatka
Types by Adform Research, Saulius ValatkaTypes by Adform Research, Saulius Valatka
Types by Adform Research, Saulius Valatka
 
Types by Adform Research
Types by Adform ResearchTypes by Adform Research
Types by Adform Research
 
Scalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex GryzlovScalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex Gryzlov
 
Scalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex GryzlovScalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex Gryzlov
 
Spark by Adform Research, Paulius
Spark by Adform Research, PauliusSpark by Adform Research, Paulius
Spark by Adform Research, Paulius
 
Scala Style by Adform Research (Saulius Valatka)
Scala Style by Adform Research (Saulius Valatka)Scala Style by Adform Research (Saulius Valatka)
Scala Style by Adform Research (Saulius Valatka)
 
Spark intro by Adform Research
Spark intro by Adform ResearchSpark intro by Adform Research
Spark intro by Adform Research
 
Scala laboratory: Globus. iteration #2
Scala laboratory: Globus. iteration #2Scala laboratory: Globus. iteration #2
Scala laboratory: Globus. iteration #2
 
Testing in Scala. Adform Research
Testing in Scala. Adform ResearchTesting in Scala. Adform Research
Testing in Scala. Adform Research
 
Scala laboratory. Globus. iteration #1
Scala laboratory. Globus. iteration #1Scala laboratory. Globus. iteration #1
Scala laboratory. Globus. iteration #1
 
Cassandra + Spark + Elk
Cassandra + Spark + ElkCassandra + Spark + Elk
Cassandra + Spark + Elk
 
Опыт использования Spark, Основано на реальных событиях
Опыт использования Spark, Основано на реальных событияхОпыт использования Spark, Основано на реальных событиях
Опыт использования Spark, Основано на реальных событиях
 
ETL со Spark
ETL со SparkETL со Spark
ETL со Spark
 
Funtional Reactive Programming with Examples in Scala + GWT
Funtional Reactive Programming with Examples in Scala + GWTFuntional Reactive Programming with Examples in Scala + GWT
Funtional Reactive Programming with Examples in Scala + GWT
 

Recently uploaded

sample sample sample sample sample sample
sample sample sample sample sample samplesample sample sample sample sample sample
sample sample sample sample sample sample
Casey Keith
 
IATA GEOGRAPHY AREAS in the world, HM111
IATA GEOGRAPHY AREAS in the world, HM111IATA GEOGRAPHY AREAS in the world, HM111
IATA GEOGRAPHY AREAS in the world, HM111
2022472524
 
Vadodara Escort💋 Call Girl (Bindu) Service #Vadodara Call Girl @Independent G...
Vadodara Escort💋 Call Girl (Bindu) Service #Vadodara Call Girl @Independent G...Vadodara Escort💋 Call Girl (Bindu) Service #Vadodara Call Girl @Independent G...
Vadodara Escort💋 Call Girl (Bindu) Service #Vadodara Call Girl @Independent G...
mountabuangels4u
 
sample sample sample sample sample sample
sample sample sample sample sample samplesample sample sample sample sample sample
sample sample sample sample sample sample
Casey Keith
 
Four Famous Temples In Jammu and Kashmir
Four Famous Temples In Jammu and KashmirFour Famous Temples In Jammu and Kashmir
Four Famous Temples In Jammu and Kashmir
SuYatra
 

Recently uploaded (20)

Raiganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Raiganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelRaiganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Raiganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
sample sample sample sample sample sample
sample sample sample sample sample samplesample sample sample sample sample sample
sample sample sample sample sample sample
 
Shimla Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Shimla Call Girls 🥰 8617370543 Service Offer VIP Hot ModelShimla Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Shimla Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
IATA GEOGRAPHY AREAS in the world, HM111
IATA GEOGRAPHY AREAS in the world, HM111IATA GEOGRAPHY AREAS in the world, HM111
IATA GEOGRAPHY AREAS in the world, HM111
 
Howrah Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Howrah Call Girls 🥰 8617370543 Service Offer VIP Hot ModelHowrah Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Howrah Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
TOURISM ATTRACTION IN LESOTHO 2024.pptx.
TOURISM ATTRACTION IN LESOTHO 2024.pptx.TOURISM ATTRACTION IN LESOTHO 2024.pptx.
TOURISM ATTRACTION IN LESOTHO 2024.pptx.
 
Vadodara Escort💋 Call Girl (Bindu) Service #Vadodara Call Girl @Independent G...
Vadodara Escort💋 Call Girl (Bindu) Service #Vadodara Call Girl @Independent G...Vadodara Escort💋 Call Girl (Bindu) Service #Vadodara Call Girl @Independent G...
Vadodara Escort💋 Call Girl (Bindu) Service #Vadodara Call Girl @Independent G...
 
ITALY - Visa Options for expats and digital nomads
ITALY - Visa Options for expats and digital nomadsITALY - Visa Options for expats and digital nomads
ITALY - Visa Options for expats and digital nomads
 
sample sample sample sample sample sample
sample sample sample sample sample samplesample sample sample sample sample sample
sample sample sample sample sample sample
 
Four Famous Temples In Jammu and Kashmir
Four Famous Temples In Jammu and KashmirFour Famous Temples In Jammu and Kashmir
Four Famous Temples In Jammu and Kashmir
 
Mehsana Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mehsana Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMehsana Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mehsana Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Explore Dubai with - Forever Tourism
Explore  Dubai  with  -  Forever  TourismExplore  Dubai  with  -  Forever  Tourism
Explore Dubai with - Forever Tourism
 
Siliguri Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Siliguri Call Girls 🥰 8617370543 Service Offer VIP Hot ModelSiliguri Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Siliguri Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Abortion pills in Jeddah +966572737505 <> buy cytotec <> unwanted kit Saudi A...
Abortion pills in Jeddah +966572737505 <> buy cytotec <> unwanted kit Saudi A...Abortion pills in Jeddah +966572737505 <> buy cytotec <> unwanted kit Saudi A...
Abortion pills in Jeddah +966572737505 <> buy cytotec <> unwanted kit Saudi A...
 
Bhadrachalam Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Bhadrachalam Call Girls 🥰 8617370543 Service Offer VIP Hot ModelBhadrachalam Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Bhadrachalam Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Nainital Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Nainital Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNainital Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Nainital Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Sun World Bana Hills, Vienam Part 2 (越南 巴拿山太陽世界 下集).ppsx
Sun World Bana Hills, Vienam Part 2  (越南 巴拿山太陽世界 下集).ppsxSun World Bana Hills, Vienam Part 2  (越南 巴拿山太陽世界 下集).ppsx
Sun World Bana Hills, Vienam Part 2 (越南 巴拿山太陽世界 下集).ppsx
 
Kashipur Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Kashipur Call Girls 🥰 8617370543 Service Offer VIP Hot ModelKashipur Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Kashipur Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Top places to visit, top tourist destinations
Top places to visit, top tourist destinationsTop places to visit, top tourist destinations
Top places to visit, top tourist destinations
 
Lansdowne Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Lansdowne Call Girls 🥰 8617370543 Service Offer VIP Hot ModelLansdowne Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Lansdowne Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 

SBT by Aform Research, Saulius Valatka

  • 2. Building scala/Java projects • Option #1: scalac/javac scalac HelloWorld.scala // outputs .class files • Option #2: build system • Ant (old and lame) • Maven (too much XML) • Ivy (limited) • sbt (powerful)
  • 3. End result • .class files contain bytecode (directory structure <-> packages) • .jar files are zipped up .class files • MANIFEST files can specify the main class in a .jar • run with java jar yourfile.jar
  • 4. Maven – the bad part
  • 5. Maven – the good parts • Source code structure: • src • main • java • com/adform/dspr • Processor.Java • test • java • com/adform/dsrp • ProcessorTest.Java • target • pom.xml • README.md
  • 6. Ivy/Maven – the good parts • Dependency management <dependency> <groupId>com.twitter</groupId> <artifactId>scalding-core_2.9.2</artifactId> <version>0.8.4</version> </dependency> • Libraries make graphs of dependencies • JARs are published to repositories ( http://search.maven.org/ ) • Maven resolves/downloads everything!
  • 8. sbt • Simple (haha!) Build Tool • Can compile both Java and Scala projects • Build definitions are scala programs • Uses Ivy dependency management
  • 9. sbt – project layout • src • main • scala • com/adform/dspr • Processor.scala • test • scala • com/adform/dsrp • ProcessorTest.scala • target • project • target • Build.scala • plugins.sbt • build.properties • build.sbt • version.sbt • README.md
  • 10. Minimal build.sbt organization := "com.adform.dspr" name := "vertica-udfs" scalaVersion := "2.11.2" resolvers ++= Seq( "Concurrent Maven Repo" at "http://conjars.org/repo", ) libraryDependencies ++= Seq( "io.argonaut" % "argonaut_2.10" % "6.0.4" )
  • 11. Usage • sbt test/compile/run/package • sbt ~compile/~test • sbt reload compile run
  • 12. Some (very simplified) Theory • A build is a Seq[Setting[T]] • A Setting[T] is either a property or a Task • e.g. name = SettingKey[String]("name", "Project name.") • e.g. compile = TaskKey[Analysis]("compile", "Compiles sources.") • A build definition transforms the Settings • e.g. name := "vertica-udfs” [def :=(v: T): Setting[T]]
  • 13. Some (very simplified) Theory • You can define your own tasks/settings • e.g. • lazy val hello = taskKey[Unit]("An example task") • hello := { println("Hello!") } • sbt hello • Settings/Tasks have scopes • e.g. name in Compile := "hello"
  • 14. Some (very simplified) Theory • Settings can also be modified with other operators: • libraryDependencies ++= Seq(…) • resolvers += “Repository” at “http://repo.lt/” • publishTo <<= version { v => “repository/” + v }
  • 15. More details • A build consists of project/*.scala + *.sbt files • Sample project/Build.scala: import sbt._ import Keys._ object HelloBuild extends Build { val sampleKeyB = settingKey[String]("demo key B") lazy val root = Project(id = "hello", base = file("."), settings = Seq( sampleKeyB := "B: in the root project settings in Build.scala" )) }
  • 16. More details • .scala builds useful for multi-project builds • Also useful for shared code across .sbt files • .sbt take precedence over project/.scala! • project/build.properties used to specify sbt version
  • 17. Plot twist! • How do you build the build project ?
  • 18. Plot twist! • How do you build the build project ? • With sbt! • project is the root folder of the build application • plugins.sbt is the definition of the build of the build!
  • 19. Plugins • They are just library dependencies for the build project! • Useful plugins: assembly, dependency-graph • http://www.scala-sbt.org/0.13/docs/Community-Plugins.html
  • 20. Library dependencies libraryDependencies ++= Seq( "org.scalatest" %% "scalatest" % "2.2.2" % "test“ ) %% === % “scalatest_2.10” % “test” === use only in test scope
  • 21. Library dependencies resolvers ++= Seq( "Twitter Maven" at "http://maven.twttr.com", "Adform Repo" at "http://ec2-54-74-8-112.eu-west-1.compute.amazonaws.com/repository/releases“ ) Dependencies are also cached in ~/.ivy2 – clear cache if something is off!