SlideShare a Scribd company logo
1 of 58
SBT
Baby steps
January 2018
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
> agenda
2
[info] build definition
[info] key, task
[info] resolvers
[info] multi-project build
[info] scope
[info] scalacOptions
[info] plugins we use
[maybe[success]] Expected time: 45 min
–Wikipedia
“sbt (Simple Build Tool) is an open-source build tool
for Scala and Java projects…”
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
500 pages of docs
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
> features of SBT
[info] little or no configuration required for simple
projects
[info] scala-based build definition
[info] incremental recompilation
[info] packages and publishes jars, generates docs
[info] supports testing with ScalaCheck, specs, ScalaTest
[info] modularization
[info] external project support (list a git repo as a
dependency)
[info] parallel task/test execution
[info] library management support
[info] more
[success] Total time: 0 s, completed 27/01/2018 6:35:31 PM
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[error] (subs/*:projectDescriptors) Could not create file
/home/svc_jenkins/jenkins_workspace/Substitutability/subs-build-
pr/subs/target/streams/$global/projectDescriptors/$global/streams/outjava.io.IOExcepti
on: No such file or directory
[error] Total time: 0 s, completed Jan 15, 2018 2:39:24 AM
Build step 'Build using sbt' changed build result to FAILURE
Build step 'Build using sbt' marked build as failure
[CHECKSTYLE] Skipping publisher since build result is FAILURE
[WARNINGS] Skipping publisher since build result is FAILURE
Publishing Scoverage XML and HTML report ...
ERROR: Step ?Publish Scoverage Report? aborted due to exception:
java.io.IOException: /home/svc_jenkins/jenkins_workspace/Substitutability/subs-build-
pr/target/scala-2.11/scoverage-report not exists
at
org.jenkinsci.plugins.scoverage.ScoveragePublisher.copyReport(ScoveragePublisher.java:
114)
at
org.jenkinsci.plugins.scoverage.ScoveragePublisher.perform(ScoveragePublisher.java:66)
……
Notified Stash for commit with id f83c0fecc73c477c18843208317f9523a9b17882
Finished: FAILURE
> the basics
[info] build defined in objects extending Build
[info] builds are composed from Projects.
May be local (file) or remote (git url)
[info] projects are a sequence of Settings
[info] settings are key-initialization pairs
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
sbt.version = 0.13.16
build.properties
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
import sbt._
import sbt.Keys._
object ExampleBuild extends Build {
val dependencies = Seq(
"org.scalatest" %% "scalatest" % "1.9.1" % "test"
)
lazy val exampleProject =
Project("example", file(".")) settings(
version := "0.1",
organization := "com.companyname",
scalaVersion := "2.12.4",
libraryDependencies ++= dependencies
)
}
Extending the SBT Build object
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
name := "example"
version := "0.1"
organization := "com.companyname"
scalaVersion := "2.12.4"
libraryDependencies +=
"org.scalatest" %%
"scalatest" % "1.9.1" % "test"
build.sbt file
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
name := "example"
version := "0.1"
organization := "com.companyname"
scalaVersion := "2.12.4"
libraryDependencies +=
"org.scalatest" %%
"scalatest" % "1.9.1" % "test"
build.sbt file
{ }
——— —-————
key operator body
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
build.sbt file
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
:= replace existing
+= add one element
++= add Seq[T](…)
> keys
[info] SettingKey[T]
For static values
name, version, organization
[info] TaskKey[T]
For (re-)computed values
sources, compile
[info] InputKey[T]
For generating a Task from user input
run-main my.main.class
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
Custom Key
lazy val hello = taskKey[Unit]("An example task")
lazy val root = (project in file("."))
.settings(
hello := { println("Hello!") }
)
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
Definition of Task
lazy val hello = taskKey[Unit]("An example task")
lazy val root = (project in file("."))
.settings(
hello := { println("Hello!") }
)
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
> reload
[info] Loading project definition from
/Users/marina/IdeaProjects/example/project
[info] Set current project to example (in build
file:/Users/marina/IdeaProjects/example/)
> hello
Hello!
[success] Total time: 0 s, completed 21/01/2018
9:40:41 PM
>
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
Int Task
lazy val hello = taskKey[Int]("An example task")
lazy val root = (project in file("."))
.settings(
hello := {
println(“Hello!")
2
}
)
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
> show hello
Hello!
[info] 2
[success] Total time: 0 s, completed 21/01/2018 9:40:41 PM
> inspect hello
[info] Task: Int
[info] Description:
[info] An example task
[info] Provided by:
[info] {file:/Users/marina/IdeaProjects/example/}root/*:hello
[info] Defined at:
[info] /Users/marina/IdeaProjects/example/build.sbt:19
[info] Delegates:
[info] *:hello
[info] {.}/*:hello
[info] */*:hello
>
> show, inspect
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
> show package
[info] Packaging
/Users/marina/IdeaProjects/example/target/scala-
2.12/example_2.12-0.1.jar ...
[info] Done packaging.
[info]
/Users/marina/IdeaProjects/example/target/scala-
2.12/example_2.12-0.1.jar
[success] Total time: 0 s, completed 20/01/2018
10:04:01 PM
>
> show package
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
import sbt._
object Dependencies {
object Versions {
val scala = "2.12.4"
val scalatest = "3.0.1"
val shapeless = "2.3.2"
}
val testLibs = Seq(
"org.scalatest" %% "scalatest" % Versions.scalatest
).map(_ % "test")
def mainLibs = Seq(
"com.chuusai" %% "shapeless" % Versions.shapeless,
"org.scala-lang" % "scala-reflect" % Versions.scala
)
}
Dependencies.scala
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
import Dependencies._
name := "example"
version := "0.1"
scalaVersion := "2.12.4"
organization := "com.companyname"
libraryDependencies ++= mainLibs ++ testLibs
build.sbt
libraryDependencies ++= Seq(
groupID % artifactID % revision,
groupID % otherID % otherRevision
)
< artifactID
< revision
< groupID
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
import Dependencies._
name := "example"
version := "0.1"
scalaVersion := "2.12.4"
organization := “com.companyname"
resolvers += "Java.net Maven2 Repository" at
"http://download.java.net/maven/2/"
libraryDependencies ++= mainLibs ++ testLibs
build.sbt
https://www.scala-sbt.org/0.13/docs/Resolvers.html
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
Proxy Repositories
Nexus Artifactory Archiva
OR
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
-Dsbt.repository.config=<path-to-your-repo-file>
OR
Proxy Repositories
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
Nexus Artifactory Archiva
–Wikipedia
Apache Ivy is a transitive package manager.
Build tools and continuous integration servers regularly
support or include Ivy:
• sbt (included in dependency management)
• Jenkins
•…
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
Ivy Maven
sbt
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
MacBook-Pro:IdeaProjects marina$ cd example
MacBook-Pro:example marina$ cd ~/.ivy2
MacBook-Pro:.ivy2 marina$ ls
cache exclude_classifiers exclude_classifiers.lock
MacBook-Pro:.ivy2 marina$ cd cache/
MacBook-Pro:cache marina$ ls
args4j
com.chuusai
com.eed3si9n
com.github.ben-manes.caffeine
com.github.cb372
com.google
com.google.code.findbugs
com.google.code.gson
com.google.guava
com.google.protobuf
com.googlecode.json-simple
com.jcraft
com.lihaoyi
com.lmax
com.squareup.okhttp3
com.squareup.okio
com.thoughtworks.paranamer
com.trueaccord.lenses
com.trueaccord.scalapb
com.typesafe
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
val setts = Seq(
version := "0.1",
scalaVersion := "2.12.4",
organization := "com.companyname"
)
libraryDependencies ++= mainLibs ++ testLibs
lazy val root =
Project(
id = "example",
base = file("."),
dependencies = Seq(
domain,
magnolia
)
)
.settings(setts)
.settings(libraryDependencies ++= mainLibs ++ testLibs)
lazy val magnolia = ProjectRef(
uri("git://github.com/etaty/scalacheck-magnolia.git"),
"scalacheck-magnolia"
)
lazy val domain = Project(
id = "example-domain",
base = file("example-domain"))
.settings(setts)
.settings(moduleName := "domain")
build.sbt
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
Build
root
domain
magnolia
Cloning into ‘/Users/marina/.sbt/0.13/staging/8924b22f06679a54873e/scalacheck-magnolia'...
[info] Loading project definition from /Users/marina/IdeaProjects/example/project
[info] Loading project definition from
/Users/marina/.sbt/0.13/staging/8924b22f06679a54873e/scalacheck-magnolia/project
[info] Set current project to example (in build file:/Users/marina/IdeaProjects/example/)
[info] Updating {git://github.com/etaty/scalacheck-magnolia.git}scalacheck-magnolia...
[info] downloading
https://repo1.maven.org/maven2/com/propensive/magnolia_2.12/0.6.1/magnolia_2.12-0.6.1.jar
...
[info] [SUCCESSFUL ] com.propensive#magnolia_2.12;0.6.1!magnolia_2.12.jar (2011ms)
[info] downloading
https://repo1.maven.org/maven2/org/scalacheck/scalacheck_2.12/1.13.4/scalacheck_2.12-
1.13.4.jar ...
[info] [SUCCESSFUL ] org.scalacheck#scalacheck_2.12;1.13.4!scalacheck_2.12.jar (4767ms)
[info] Done updating.
[info] Updating {file:/Users/marina/IdeaProjects/example/}example...
[info] Done updating.
[info] Compiling 2 Scala sources to
/Users/marina/.sbt/0.13/staging/8924b22f06679a54873e/scalacheck-magnolia/target/scala-
2.12/classes...
[info] 'compiler-interface' not yet compiled for Scala 2.12.4. Compiling...
[info] Compilation completed in 12.795 s
[success] Total time: 28 s, completed 19/01/2018 11:35:13 AM
> compile
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
Cloning into ‘/Users/marina/.sbt/0.13/staging/8924b22f06679a54873e/scalacheck-magnolia'...
[info] Loading project definition from /Users/marina/IdeaProjects/example/project
[info] Loading project definition from
/Users/marina/.sbt/0.13/staging/8924b22f06679a54873e/scalacheck-magnolia/project
[info] Set current project to example (in build file:/Users/marina/IdeaProjects/example/)
[info] Updating {git://github.com/etaty/scalacheck-magnolia.git}scalacheck-magnolia...
[info] downloading
https://repo1.maven.org/maven2/com/propensive/magnolia_2.12/0.6.1/magnolia_2.12-0.6.1.jar
...
[info] [SUCCESSFUL ] com.propensive#magnolia_2.12;0.6.1!magnolia_2.12.jar (2011ms)
[info] downloading
https://repo1.maven.org/maven2/org/scalacheck/scalacheck_2.12/1.13.4/scalacheck_2.12-
1.13.4.jar ...
[info] [SUCCESSFUL ] org.scalacheck#scalacheck_2.12;1.13.4!scalacheck_2.12.jar (4767ms)
[info] Done updating.
[info] Updating {file:/Users/marina/IdeaProjects/example/}example...
[info] Done updating.
[info] Compiling 2 Scala sources to
/Users/marina/.sbt/0.13/staging/8924b22f06679a54873e/scalacheck-magnolia/target/scala-
2.12/classes...
[info] 'compiler-interface' not yet compiled for Scala 2.12.4. Compiling...
[info] Compilation completed in 12.795 s
[success] Total time: 28 s, completed 19/01/2018 11:35:13 AM
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
> compile
Cloning into ‘/Users/marina/.sbt/0.13/staging/8924b22f06679a54873e/scalacheck-magnolia'...
[info] Loading project definition from /Users/marina/IdeaProjects/example/project
[info] Loading project definition from
/Users/marina/.sbt/0.13/staging/8924b22f06679a54873e/scalacheck-magnolia/project
[info] Set current project to example (in build file:/Users/marina/IdeaProjects/example/)
[info] Updating {git://github.com/etaty/scalacheck-magnolia.git}scalacheck-magnolia...
[info] downloading
https://repo1.maven.org/maven2/com/propensive/magnolia_2.12/0.6.1/magnolia_2.12-0.6.1.jar
...
[info] [SUCCESSFUL ] com.propensive#magnolia_2.12;0.6.1!magnolia_2.12.jar (2011ms)
[info] downloading
https://repo1.maven.org/maven2/org/scalacheck/scalacheck_2.12/1.13.4/scalacheck_2.12-
1.13.4.jar ...
[info] [SUCCESSFUL ] org.scalacheck#scalacheck_2.12;1.13.4!scalacheck_2.12.jar (4767ms)
[info] Done updating.
[info] Updating {file:/Users/marina/IdeaProjects/example/}example...
[info] Done updating.
[info] Compiling 2 Scala sources to
/Users/marina/.sbt/0.13/staging/8924b22f06679a54873e/scalacheck-magnolia/target/scala-
2.12/classes...
[info] 'compiler-interface' not yet compiled for Scala 2.12.4. Compiling...
[info] Compilation completed in 12.795 s
[success] Total time: 28 s, completed 19/01/2018 11:35:13 AM
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
> compile
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
> Project
> scope
1. Keys can have different values in
different scopes
• sources in Compile
• sources in Test
2. Keys can be scoped by tasks or
configuration
3. Configurations can extend from each other
• val Test = config("test") extend Compile
The subproject axis
The configuration axis
The task axis
> scope
> scope
Compile, Test
task keys compile, package, run
Project(id = "example-domain")
> referring to scopes in a build definition
lazy val root = (project in file("."))
.settings(
name := "hello"
)
name in Compile := “hello"
name in packageBin := “hello"
name in (Compile, packageBin) := “hello"
> referring to scopes in a build definition
lazy val root = (project in file("."))
.settings(
name := "hello"
)
name in Compile := "hello"
name in packageBin := "hello"
name in (Compile, packageBin) := “hello"
> referring to scopes in a build definition
lazy val root = (project in file("."))
.settings(
name := "hello"
)
name in Compile := "hello"
name in packageBin := "hello"
name in (Compile, packageBin) := "hello"
> scalacOptions
scalacOptions ++= Seq(
"-encoding", "UTF-8",
"-unchecked",
"-deprecation",
"-Ywarn-dead-code"
)
> scalacOptions
scalacOptions ++= Seq(
"-encoding", "UTF-8",
"-unchecked",
"-deprecation",
"-Ywarn-dead-code"
)
> scalacOptions
"-unchecked"
"-deprecation",
"-Ywarn-dead-code"
)
def printListType(lst: List[AnyVal]) = lst match {
case strings: List[String] => println(s"List of Strings
$strList")
case integers: List[Int] => println(s"List of Strings
$intList")
}
> scalacOptions
scalacOptions ++= Seq(
"-encoding", "UTF-8",
"-unchecked",
"-deprecation",
"-Ywarn-dead-code"
)
> scalacOptions
"-deprecation"
"-Ywarn-dead-code"
)
NO OPTION
[warn] there were three deprecation warnings;
re-run with -deprecation for details
WITH OPTION
[warn] Foo.scala:451: method listAll
in class Bar is deprecated: Don't use this method.
Its super broken.
[warn] Bar.listAll(user)
> scalacOptions
scalacOptions ++= Seq(
"-encoding", "UTF-8",
"-unchecked",
"-deprecation",
"-Ywarn-dead-code"
)
> scalacOptions
"-Ywarn-dead-code"
scala> def bar (a: Int): Int = {
| return 0
| a + 10
| }
:12: warning: dead code following this construct
return 0
^
bar: (a: Int)Int
> plugins.sbt
addSbtPlugin("com.eed3si9n" %
"sbt-man" % "0.1.0"
) // look up scaladoc
addSbtPlugin("com.eed3si9n" %
"sbt-dirty-money" % "0.1.0")
// clean Ivy2's cache
addSbtPlugin("com.eed3si9n" %
"sbt-assembly" % "0.14.6")
// create a fat JAR of your project
// with all of its dependencies
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
> assembly
• Merge Strategy
• Shading
• Excluding JARs and files
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
> assembly
•Merge Strategy
Shading
Excluding JARs and files
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
MergeStrategy.deduplicate
verify all files have the same contents & error out otherwise
MergeStrategy.first
picks the first of the matching files in classpath order
MergeStrategy.last picks the last one
MergeStrategy.singleOrError
bails out with an error message on conflict
MergeStrategy.concat
concatenates all matching files and includes the result
MergeStrategy.filterDistinctLines
also concatenates, but leaves out duplicates along the way
MergeStrategy.rename
renames the files originating from jar files
MergeStrategy.discard discards matching files
•Merge Strategy
Shading
Excluding JARs and files
> assembly
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
lazy val root =
Project(
id = "example",
base = file("."),
dependencies = Seq(
domain,
magnolia
)
)
.settings(setts)
.settings(libraryDependencies ++= mainLibs ++ testLibs)
.settings(assemblyJarName in assembly := "example.jar")
.settings(
assemblyMergeStrategy in assembly := {
case "application.conf" => MergeStrategy.concat
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
)
•Merge Strategy
Shading
Excluding JARs and files
> assembly
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
> assembly
[info] Including: scala-library-2.12.4.jar
[info] Including: scala-compiler-2.12.4.jar
…
[info] Merging files...
[warn] Merging 'META-INF/MANIFEST.MF' with strategy 'discard'
[warn] Merging 'META-INF/maven/jline/jline/pom.properties'
with strategy 'discard'
[warn] Merging 'META-INF/maven/jline/jline/pom.xml' with
strategy 'discard'
[warn] Merging 'application.conf' with strategy 'concat'
[warn] Merging 'rootdoc.txt' with strategy 'concat'
[warn] Strategy 'concat' was applied to 2 files
[warn] Strategy 'discard' was applied to 3 files
[info] SHA-1: 642c5daa2bfc30a825f08fa72a51a990cac441fc
[info] Packaging /Users/marina/IdeaProjects/example/target/scala-2.12/example.
[info] Done packaging.
Merge Strategy
•Shading
Excluding JARs and files
> assembly
ShadeRule.rename("x.**" -> "y.@1", …)
ShadeRule.zap("a.b.c")
any matched class to be removed from
the resulting jar file
ShadeRule.keep("x.**")
rule marks all matched classes
as "roots"
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
> stackoverflow.com
Merge Strategy
•Shading
Excluding JARs and files
> assembly
.settings(
assemblyShadeRules in assembly := Seq(
ShadeRule.rename("com.google.**" -> "org.moogle.@1").inProject
)
)
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
•Merge Strategy
•Shading
•Excluding JARs and files
> assembly
libraryDependencies ++= Seq(
("org.apache.spark" %% "spark-core" % "0.8.0-incubating")
.exclude("commons-logging", "commons-logging")
)
assemblyMergeStrategy in assembly := {
case PathList("about.html") => MergeStrategy.rename
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
> summary
[info] Build -> Project -> Settings
[info] s & tasks
[info] Proxy Resolvers
[info] Multi-project build
[info] Scope
[info] scalacOptions
[info] Plugins we use
[success] Total time: 45 min
© 2018 The Quantium Group Pty Ltd. In Commercial Confidence
Thank you!

More Related Content

What's hot

Spring Batch Workshop (advanced)
Spring Batch Workshop (advanced)Spring Batch Workshop (advanced)
Spring Batch Workshop (advanced)lyonjug
 
A Prelude of Purity: Scaling Back ZIO
A Prelude of Purity: Scaling Back ZIOA Prelude of Purity: Scaling Back ZIO
A Prelude of Purity: Scaling Back ZIOJorge Vásquez
 
Java 8-streams-collectors-patterns
Java 8-streams-collectors-patternsJava 8-streams-collectors-patterns
Java 8-streams-collectors-patternsJosé Paumard
 
Deep dive into Coroutines on JVM @ KotlinConf 2017
Deep dive into Coroutines on JVM @ KotlinConf 2017Deep dive into Coroutines on JVM @ KotlinConf 2017
Deep dive into Coroutines on JVM @ KotlinConf 2017Roman Elizarov
 
Programación Funcional 101 con Scala y ZIO 2.0
Programación Funcional 101 con Scala y ZIO 2.0Programación Funcional 101 con Scala y ZIO 2.0
Programación Funcional 101 con Scala y ZIO 2.0Jorge Vásquez
 
[JCConf 2020] 用 Kotlin 跨入 Serverless 世代
[JCConf 2020] 用 Kotlin 跨入 Serverless 世代[JCConf 2020] 用 Kotlin 跨入 Serverless 世代
[JCConf 2020] 用 Kotlin 跨入 Serverless 世代Shengyou Fan
 
Kotlin Coroutines. Flow is coming
Kotlin Coroutines. Flow is comingKotlin Coroutines. Flow is coming
Kotlin Coroutines. Flow is comingKirill Rozov
 
Virtual Flink Forward 2020: A deep dive into Flink SQL - Jark Wu
Virtual Flink Forward 2020: A deep dive into Flink SQL - Jark WuVirtual Flink Forward 2020: A deep dive into Flink SQL - Jark Wu
Virtual Flink Forward 2020: A deep dive into Flink SQL - Jark WuFlink Forward
 
Scaling Django with gevent
Scaling Django with geventScaling Django with gevent
Scaling Django with geventMahendra M
 
Exception handling
Exception handlingException handling
Exception handlingAnna Pietras
 
Cassandra concepts, patterns and anti-patterns
Cassandra concepts, patterns and anti-patternsCassandra concepts, patterns and anti-patterns
Cassandra concepts, patterns and anti-patternsDave Gardner
 
Swift in SwiftUI
Swift in SwiftUISwift in SwiftUI
Swift in SwiftUIBongwon Lee
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!Jakub Kubrynski
 
(참고) Elk stack 설치 및 kafka
(참고) Elk stack 설치 및 kafka(참고) Elk stack 설치 및 kafka
(참고) Elk stack 설치 및 kafkaNoahKIM36
 
구글테스트
구글테스트구글테스트
구글테스트진화 손
 
炎炎夏日學 Android 課程 - Part1: Kotlin 語法介紹
炎炎夏日學 Android 課程 -  Part1: Kotlin 語法介紹炎炎夏日學 Android 課程 -  Part1: Kotlin 語法介紹
炎炎夏日學 Android 課程 - Part1: Kotlin 語法介紹Johnny Sung
 

What's hot (20)

Spring Batch Workshop (advanced)
Spring Batch Workshop (advanced)Spring Batch Workshop (advanced)
Spring Batch Workshop (advanced)
 
A Prelude of Purity: Scaling Back ZIO
A Prelude of Purity: Scaling Back ZIOA Prelude of Purity: Scaling Back ZIO
A Prelude of Purity: Scaling Back ZIO
 
Java 8-streams-collectors-patterns
Java 8-streams-collectors-patternsJava 8-streams-collectors-patterns
Java 8-streams-collectors-patterns
 
Deep dive into Coroutines on JVM @ KotlinConf 2017
Deep dive into Coroutines on JVM @ KotlinConf 2017Deep dive into Coroutines on JVM @ KotlinConf 2017
Deep dive into Coroutines on JVM @ KotlinConf 2017
 
Programación Funcional 101 con Scala y ZIO 2.0
Programación Funcional 101 con Scala y ZIO 2.0Programación Funcional 101 con Scala y ZIO 2.0
Programación Funcional 101 con Scala y ZIO 2.0
 
[JCConf 2020] 用 Kotlin 跨入 Serverless 世代
[JCConf 2020] 用 Kotlin 跨入 Serverless 世代[JCConf 2020] 用 Kotlin 跨入 Serverless 世代
[JCConf 2020] 用 Kotlin 跨入 Serverless 世代
 
Kotlin Coroutines. Flow is coming
Kotlin Coroutines. Flow is comingKotlin Coroutines. Flow is coming
Kotlin Coroutines. Flow is coming
 
Virtual Flink Forward 2020: A deep dive into Flink SQL - Jark Wu
Virtual Flink Forward 2020: A deep dive into Flink SQL - Jark WuVirtual Flink Forward 2020: A deep dive into Flink SQL - Jark Wu
Virtual Flink Forward 2020: A deep dive into Flink SQL - Jark Wu
 
Scaling Django with gevent
Scaling Django with geventScaling Django with gevent
Scaling Django with gevent
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Practical Object Oriented Models In Sql
Practical Object Oriented Models In SqlPractical Object Oriented Models In Sql
Practical Object Oriented Models In Sql
 
Exception handling
Exception handlingException handling
Exception handling
 
Cassandra concepts, patterns and anti-patterns
Cassandra concepts, patterns and anti-patternsCassandra concepts, patterns and anti-patterns
Cassandra concepts, patterns and anti-patterns
 
Kotlin
KotlinKotlin
Kotlin
 
Swift in SwiftUI
Swift in SwiftUISwift in SwiftUI
Swift in SwiftUI
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!
 
(참고) Elk stack 설치 및 kafka
(참고) Elk stack 설치 및 kafka(참고) Elk stack 설치 및 kafka
(참고) Elk stack 설치 및 kafka
 
Java 8 Lambda and Streams
Java 8 Lambda and StreamsJava 8 Lambda and Streams
Java 8 Lambda and Streams
 
구글테스트
구글테스트구글테스트
구글테스트
 
炎炎夏日學 Android 課程 - Part1: Kotlin 語法介紹
炎炎夏日學 Android 課程 -  Part1: Kotlin 語法介紹炎炎夏日學 Android 課程 -  Part1: Kotlin 語法介紹
炎炎夏日學 Android 課程 - Part1: Kotlin 語法介紹
 

Similar to Sbt baby steps

Check Point automatizace a orchestrace
Check Point automatizace a orchestraceCheck Point automatizace a orchestrace
Check Point automatizace a orchestraceMarketingArrowECS_CZ
 
Extending uBuild and uDeploy with Plugins
Extending uBuild and uDeploy with PluginsExtending uBuild and uDeploy with Plugins
Extending uBuild and uDeploy with PluginsIBM UrbanCode Products
 
Masterless Puppet Using AWS S3 Buckets and IAM Roles
Masterless Puppet Using AWS S3 Buckets and IAM RolesMasterless Puppet Using AWS S3 Buckets and IAM Roles
Masterless Puppet Using AWS S3 Buckets and IAM RolesMalcolm Duncanson, CISSP
 
使用 Prometheus 監控 Kubernetes Cluster
使用 Prometheus 監控 Kubernetes Cluster 使用 Prometheus 監控 Kubernetes Cluster
使用 Prometheus 監控 Kubernetes Cluster inwin stack
 
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
New and cool in OSGi R7 - David Bosschaert & Carsten ZiegelerNew and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegelermfrancis
 
Application Modernization with PKS / Kubernetes
Application Modernization with PKS / KubernetesApplication Modernization with PKS / Kubernetes
Application Modernization with PKS / KubernetesPaul Czarkowski
 
Spring Cloud Function & Project riff #jsug
Spring Cloud Function & Project riff #jsugSpring Cloud Function & Project riff #jsug
Spring Cloud Function & Project riff #jsugToshiaki Maki
 
Best Practices for Scalable Monitoring (ENT310-S) - AWS re:Invent 2018
Best Practices for Scalable Monitoring (ENT310-S) - AWS re:Invent 2018Best Practices for Scalable Monitoring (ENT310-S) - AWS re:Invent 2018
Best Practices for Scalable Monitoring (ENT310-S) - AWS re:Invent 2018Amazon Web Services
 
HP Helion European Webinar Series ,Webinar #3
HP Helion European Webinar Series ,Webinar #3 HP Helion European Webinar Series ,Webinar #3
HP Helion European Webinar Series ,Webinar #3 BeMyApp
 
Salesforce meetup | Lightning Web Component
Salesforce meetup | Lightning Web ComponentSalesforce meetup | Lightning Web Component
Salesforce meetup | Lightning Web ComponentAccenture Hungary
 
How to Webpack your Django!
How to Webpack your Django!How to Webpack your Django!
How to Webpack your Django!David Gibbons
 
Spring Native and Spring AOT
Spring Native and Spring AOTSpring Native and Spring AOT
Spring Native and Spring AOTVMware Tanzu
 
Grails At Linked
Grails At LinkedGrails At Linked
Grails At LinkedLinkedIn
 
State of Steeltoe 2020
State of Steeltoe 2020State of Steeltoe 2020
State of Steeltoe 2020VMware Tanzu
 
Building Serverless ETL Pipelines
Building Serverless ETL PipelinesBuilding Serverless ETL Pipelines
Building Serverless ETL PipelinesAmazon Web Services
 
Pivotal Platform - December Release A First Look
Pivotal Platform - December Release A First LookPivotal Platform - December Release A First Look
Pivotal Platform - December Release A First LookVMware Tanzu
 
How to build unified Batch & Streaming Pipelines with Apache Beam and Dataflow
How to build unified Batch & Streaming Pipelines with Apache Beam and DataflowHow to build unified Batch & Streaming Pipelines with Apache Beam and Dataflow
How to build unified Batch & Streaming Pipelines with Apache Beam and DataflowDaniel Zivkovic
 

Similar to Sbt baby steps (20)

Check Point automatizace a orchestrace
Check Point automatizace a orchestraceCheck Point automatizace a orchestrace
Check Point automatizace a orchestrace
 
Extending uBuild and uDeploy with Plugins
Extending uBuild and uDeploy with PluginsExtending uBuild and uDeploy with Plugins
Extending uBuild and uDeploy with Plugins
 
Masterless Puppet Using AWS S3 Buckets and IAM Roles
Masterless Puppet Using AWS S3 Buckets and IAM RolesMasterless Puppet Using AWS S3 Buckets and IAM Roles
Masterless Puppet Using AWS S3 Buckets and IAM Roles
 
使用 Prometheus 監控 Kubernetes Cluster
使用 Prometheus 監控 Kubernetes Cluster 使用 Prometheus 監控 Kubernetes Cluster
使用 Prometheus 監控 Kubernetes Cluster
 
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
New and cool in OSGi R7 - David Bosschaert & Carsten ZiegelerNew and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
 
Application Modernization with PKS / Kubernetes
Application Modernization with PKS / KubernetesApplication Modernization with PKS / Kubernetes
Application Modernization with PKS / Kubernetes
 
Spring Cloud Function & Project riff #jsug
Spring Cloud Function & Project riff #jsugSpring Cloud Function & Project riff #jsug
Spring Cloud Function & Project riff #jsug
 
SBT Concepts, part 2
SBT Concepts, part 2SBT Concepts, part 2
SBT Concepts, part 2
 
Best Practices for Scalable Monitoring (ENT310-S) - AWS re:Invent 2018
Best Practices for Scalable Monitoring (ENT310-S) - AWS re:Invent 2018Best Practices for Scalable Monitoring (ENT310-S) - AWS re:Invent 2018
Best Practices for Scalable Monitoring (ENT310-S) - AWS re:Invent 2018
 
Pixels_Camp
Pixels_CampPixels_Camp
Pixels_Camp
 
HP Helion European Webinar Series ,Webinar #3
HP Helion European Webinar Series ,Webinar #3 HP Helion European Webinar Series ,Webinar #3
HP Helion European Webinar Series ,Webinar #3
 
Salesforce meetup | Lightning Web Component
Salesforce meetup | Lightning Web ComponentSalesforce meetup | Lightning Web Component
Salesforce meetup | Lightning Web Component
 
How to Webpack your Django!
How to Webpack your Django!How to Webpack your Django!
How to Webpack your Django!
 
Spring Native and Spring AOT
Spring Native and Spring AOTSpring Native and Spring AOT
Spring Native and Spring AOT
 
Grails At Linked
Grails At LinkedGrails At Linked
Grails At Linked
 
Grails at Linkedin
Grails at LinkedinGrails at Linkedin
Grails at Linkedin
 
State of Steeltoe 2020
State of Steeltoe 2020State of Steeltoe 2020
State of Steeltoe 2020
 
Building Serverless ETL Pipelines
Building Serverless ETL PipelinesBuilding Serverless ETL Pipelines
Building Serverless ETL Pipelines
 
Pivotal Platform - December Release A First Look
Pivotal Platform - December Release A First LookPivotal Platform - December Release A First Look
Pivotal Platform - December Release A First Look
 
How to build unified Batch & Streaming Pipelines with Apache Beam and Dataflow
How to build unified Batch & Streaming Pipelines with Apache Beam and DataflowHow to build unified Batch & Streaming Pipelines with Apache Beam and Dataflow
How to build unified Batch & Streaming Pipelines with Apache Beam and Dataflow
 

Recently uploaded

INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...121011101441
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitterShivangiSharma879191
 
lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxsomshekarkn64
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgsaravananr517913
 
Transport layer issues and challenges - Guide
Transport layer issues and challenges - GuideTransport layer issues and challenges - Guide
Transport layer issues and challenges - GuideGOPINATHS437943
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Piping Basic stress analysis by engineering
Piping Basic stress analysis by engineeringPiping Basic stress analysis by engineering
Piping Basic stress analysis by engineeringJuanCarlosMorales19600
 

Recently uploaded (20)

INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter
 
lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptx
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
 
Transport layer issues and challenges - Guide
Transport layer issues and challenges - GuideTransport layer issues and challenges - Guide
Transport layer issues and challenges - Guide
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
Piping Basic stress analysis by engineering
Piping Basic stress analysis by engineeringPiping Basic stress analysis by engineering
Piping Basic stress analysis by engineering
 

Sbt baby steps

  • 2. © 2018 The Quantium Group Pty Ltd. In Commercial Confidence > agenda 2 [info] build definition [info] key, task [info] resolvers [info] multi-project build [info] scope [info] scalacOptions [info] plugins we use [maybe[success]] Expected time: 45 min
  • 3. –Wikipedia “sbt (Simple Build Tool) is an open-source build tool for Scala and Java projects…” © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 4. 500 pages of docs © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 5. > features of SBT [info] little or no configuration required for simple projects [info] scala-based build definition [info] incremental recompilation [info] packages and publishes jars, generates docs [info] supports testing with ScalaCheck, specs, ScalaTest [info] modularization [info] external project support (list a git repo as a dependency) [info] parallel task/test execution [info] library management support [info] more [success] Total time: 0 s, completed 27/01/2018 6:35:31 PM © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 6. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) [error] (subs/*:projectDescriptors) Could not create file /home/svc_jenkins/jenkins_workspace/Substitutability/subs-build- pr/subs/target/streams/$global/projectDescriptors/$global/streams/outjava.io.IOExcepti on: No such file or directory [error] Total time: 0 s, completed Jan 15, 2018 2:39:24 AM Build step 'Build using sbt' changed build result to FAILURE Build step 'Build using sbt' marked build as failure [CHECKSTYLE] Skipping publisher since build result is FAILURE [WARNINGS] Skipping publisher since build result is FAILURE Publishing Scoverage XML and HTML report ... ERROR: Step ?Publish Scoverage Report? aborted due to exception: java.io.IOException: /home/svc_jenkins/jenkins_workspace/Substitutability/subs-build- pr/target/scala-2.11/scoverage-report not exists at org.jenkinsci.plugins.scoverage.ScoveragePublisher.copyReport(ScoveragePublisher.java: 114) at org.jenkinsci.plugins.scoverage.ScoveragePublisher.perform(ScoveragePublisher.java:66) …… Notified Stash for commit with id f83c0fecc73c477c18843208317f9523a9b17882 Finished: FAILURE
  • 7. > the basics [info] build defined in objects extending Build [info] builds are composed from Projects. May be local (file) or remote (git url) [info] projects are a sequence of Settings [info] settings are key-initialization pairs © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 8. © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 9. sbt.version = 0.13.16 build.properties © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 10. import sbt._ import sbt.Keys._ object ExampleBuild extends Build { val dependencies = Seq( "org.scalatest" %% "scalatest" % "1.9.1" % "test" ) lazy val exampleProject = Project("example", file(".")) settings( version := "0.1", organization := "com.companyname", scalaVersion := "2.12.4", libraryDependencies ++= dependencies ) } Extending the SBT Build object © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 11. name := "example" version := "0.1" organization := "com.companyname" scalaVersion := "2.12.4" libraryDependencies += "org.scalatest" %% "scalatest" % "1.9.1" % "test" build.sbt file © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 12. name := "example" version := "0.1" organization := "com.companyname" scalaVersion := "2.12.4" libraryDependencies += "org.scalatest" %% "scalatest" % "1.9.1" % "test" build.sbt file { } ——— —-———— key operator body © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 13. build.sbt file © 2018 The Quantium Group Pty Ltd. In Commercial Confidence := replace existing += add one element ++= add Seq[T](…)
  • 14. > keys [info] SettingKey[T] For static values name, version, organization [info] TaskKey[T] For (re-)computed values sources, compile [info] InputKey[T] For generating a Task from user input run-main my.main.class © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 15. Custom Key lazy val hello = taskKey[Unit]("An example task") lazy val root = (project in file(".")) .settings( hello := { println("Hello!") } ) © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 16. Definition of Task lazy val hello = taskKey[Unit]("An example task") lazy val root = (project in file(".")) .settings( hello := { println("Hello!") } ) © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 17. > reload [info] Loading project definition from /Users/marina/IdeaProjects/example/project [info] Set current project to example (in build file:/Users/marina/IdeaProjects/example/) > hello Hello! [success] Total time: 0 s, completed 21/01/2018 9:40:41 PM > © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 18. Int Task lazy val hello = taskKey[Int]("An example task") lazy val root = (project in file(".")) .settings( hello := { println(“Hello!") 2 } ) © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 19. > show hello Hello! [info] 2 [success] Total time: 0 s, completed 21/01/2018 9:40:41 PM > inspect hello [info] Task: Int [info] Description: [info] An example task [info] Provided by: [info] {file:/Users/marina/IdeaProjects/example/}root/*:hello [info] Defined at: [info] /Users/marina/IdeaProjects/example/build.sbt:19 [info] Delegates: [info] *:hello [info] {.}/*:hello [info] */*:hello > > show, inspect © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 20. > show package [info] Packaging /Users/marina/IdeaProjects/example/target/scala- 2.12/example_2.12-0.1.jar ... [info] Done packaging. [info] /Users/marina/IdeaProjects/example/target/scala- 2.12/example_2.12-0.1.jar [success] Total time: 0 s, completed 20/01/2018 10:04:01 PM > > show package © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 21. import sbt._ object Dependencies { object Versions { val scala = "2.12.4" val scalatest = "3.0.1" val shapeless = "2.3.2" } val testLibs = Seq( "org.scalatest" %% "scalatest" % Versions.scalatest ).map(_ % "test") def mainLibs = Seq( "com.chuusai" %% "shapeless" % Versions.shapeless, "org.scala-lang" % "scala-reflect" % Versions.scala ) } Dependencies.scala © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 22. import Dependencies._ name := "example" version := "0.1" scalaVersion := "2.12.4" organization := "com.companyname" libraryDependencies ++= mainLibs ++ testLibs build.sbt libraryDependencies ++= Seq( groupID % artifactID % revision, groupID % otherID % otherRevision ) < artifactID < revision < groupID © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 23. import Dependencies._ name := "example" version := "0.1" scalaVersion := "2.12.4" organization := “com.companyname" resolvers += "Java.net Maven2 Repository" at "http://download.java.net/maven/2/" libraryDependencies ++= mainLibs ++ testLibs build.sbt https://www.scala-sbt.org/0.13/docs/Resolvers.html © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 24. Proxy Repositories Nexus Artifactory Archiva OR © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 25. -Dsbt.repository.config=<path-to-your-repo-file> OR Proxy Repositories © 2018 The Quantium Group Pty Ltd. In Commercial Confidence Nexus Artifactory Archiva
  • 26. –Wikipedia Apache Ivy is a transitive package manager. Build tools and continuous integration servers regularly support or include Ivy: • sbt (included in dependency management) • Jenkins •… © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 27. Ivy Maven sbt © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 28. MacBook-Pro:IdeaProjects marina$ cd example MacBook-Pro:example marina$ cd ~/.ivy2 MacBook-Pro:.ivy2 marina$ ls cache exclude_classifiers exclude_classifiers.lock MacBook-Pro:.ivy2 marina$ cd cache/ MacBook-Pro:cache marina$ ls args4j com.chuusai com.eed3si9n com.github.ben-manes.caffeine com.github.cb372 com.google com.google.code.findbugs com.google.code.gson com.google.guava com.google.protobuf com.googlecode.json-simple com.jcraft com.lihaoyi com.lmax com.squareup.okhttp3 com.squareup.okio com.thoughtworks.paranamer com.trueaccord.lenses com.trueaccord.scalapb com.typesafe © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 29. val setts = Seq( version := "0.1", scalaVersion := "2.12.4", organization := "com.companyname" ) libraryDependencies ++= mainLibs ++ testLibs lazy val root = Project( id = "example", base = file("."), dependencies = Seq( domain, magnolia ) ) .settings(setts) .settings(libraryDependencies ++= mainLibs ++ testLibs) lazy val magnolia = ProjectRef( uri("git://github.com/etaty/scalacheck-magnolia.git"), "scalacheck-magnolia" ) lazy val domain = Project( id = "example-domain", base = file("example-domain")) .settings(setts) .settings(moduleName := "domain") build.sbt © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 30. © 2018 The Quantium Group Pty Ltd. In Commercial Confidence Build root domain magnolia
  • 31. Cloning into ‘/Users/marina/.sbt/0.13/staging/8924b22f06679a54873e/scalacheck-magnolia'... [info] Loading project definition from /Users/marina/IdeaProjects/example/project [info] Loading project definition from /Users/marina/.sbt/0.13/staging/8924b22f06679a54873e/scalacheck-magnolia/project [info] Set current project to example (in build file:/Users/marina/IdeaProjects/example/) [info] Updating {git://github.com/etaty/scalacheck-magnolia.git}scalacheck-magnolia... [info] downloading https://repo1.maven.org/maven2/com/propensive/magnolia_2.12/0.6.1/magnolia_2.12-0.6.1.jar ... [info] [SUCCESSFUL ] com.propensive#magnolia_2.12;0.6.1!magnolia_2.12.jar (2011ms) [info] downloading https://repo1.maven.org/maven2/org/scalacheck/scalacheck_2.12/1.13.4/scalacheck_2.12- 1.13.4.jar ... [info] [SUCCESSFUL ] org.scalacheck#scalacheck_2.12;1.13.4!scalacheck_2.12.jar (4767ms) [info] Done updating. [info] Updating {file:/Users/marina/IdeaProjects/example/}example... [info] Done updating. [info] Compiling 2 Scala sources to /Users/marina/.sbt/0.13/staging/8924b22f06679a54873e/scalacheck-magnolia/target/scala- 2.12/classes... [info] 'compiler-interface' not yet compiled for Scala 2.12.4. Compiling... [info] Compilation completed in 12.795 s [success] Total time: 28 s, completed 19/01/2018 11:35:13 AM > compile © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 32. Cloning into ‘/Users/marina/.sbt/0.13/staging/8924b22f06679a54873e/scalacheck-magnolia'... [info] Loading project definition from /Users/marina/IdeaProjects/example/project [info] Loading project definition from /Users/marina/.sbt/0.13/staging/8924b22f06679a54873e/scalacheck-magnolia/project [info] Set current project to example (in build file:/Users/marina/IdeaProjects/example/) [info] Updating {git://github.com/etaty/scalacheck-magnolia.git}scalacheck-magnolia... [info] downloading https://repo1.maven.org/maven2/com/propensive/magnolia_2.12/0.6.1/magnolia_2.12-0.6.1.jar ... [info] [SUCCESSFUL ] com.propensive#magnolia_2.12;0.6.1!magnolia_2.12.jar (2011ms) [info] downloading https://repo1.maven.org/maven2/org/scalacheck/scalacheck_2.12/1.13.4/scalacheck_2.12- 1.13.4.jar ... [info] [SUCCESSFUL ] org.scalacheck#scalacheck_2.12;1.13.4!scalacheck_2.12.jar (4767ms) [info] Done updating. [info] Updating {file:/Users/marina/IdeaProjects/example/}example... [info] Done updating. [info] Compiling 2 Scala sources to /Users/marina/.sbt/0.13/staging/8924b22f06679a54873e/scalacheck-magnolia/target/scala- 2.12/classes... [info] 'compiler-interface' not yet compiled for Scala 2.12.4. Compiling... [info] Compilation completed in 12.795 s [success] Total time: 28 s, completed 19/01/2018 11:35:13 AM © 2018 The Quantium Group Pty Ltd. In Commercial Confidence > compile
  • 33. Cloning into ‘/Users/marina/.sbt/0.13/staging/8924b22f06679a54873e/scalacheck-magnolia'... [info] Loading project definition from /Users/marina/IdeaProjects/example/project [info] Loading project definition from /Users/marina/.sbt/0.13/staging/8924b22f06679a54873e/scalacheck-magnolia/project [info] Set current project to example (in build file:/Users/marina/IdeaProjects/example/) [info] Updating {git://github.com/etaty/scalacheck-magnolia.git}scalacheck-magnolia... [info] downloading https://repo1.maven.org/maven2/com/propensive/magnolia_2.12/0.6.1/magnolia_2.12-0.6.1.jar ... [info] [SUCCESSFUL ] com.propensive#magnolia_2.12;0.6.1!magnolia_2.12.jar (2011ms) [info] downloading https://repo1.maven.org/maven2/org/scalacheck/scalacheck_2.12/1.13.4/scalacheck_2.12- 1.13.4.jar ... [info] [SUCCESSFUL ] org.scalacheck#scalacheck_2.12;1.13.4!scalacheck_2.12.jar (4767ms) [info] Done updating. [info] Updating {file:/Users/marina/IdeaProjects/example/}example... [info] Done updating. [info] Compiling 2 Scala sources to /Users/marina/.sbt/0.13/staging/8924b22f06679a54873e/scalacheck-magnolia/target/scala- 2.12/classes... [info] 'compiler-interface' not yet compiled for Scala 2.12.4. Compiling... [info] Compilation completed in 12.795 s [success] Total time: 28 s, completed 19/01/2018 11:35:13 AM © 2018 The Quantium Group Pty Ltd. In Commercial Confidence > compile
  • 34. © 2018 The Quantium Group Pty Ltd. In Commercial Confidence > Project
  • 35. > scope 1. Keys can have different values in different scopes • sources in Compile • sources in Test 2. Keys can be scoped by tasks or configuration 3. Configurations can extend from each other • val Test = config("test") extend Compile
  • 36. The subproject axis The configuration axis The task axis > scope
  • 37. > scope Compile, Test task keys compile, package, run Project(id = "example-domain")
  • 38. > referring to scopes in a build definition lazy val root = (project in file(".")) .settings( name := "hello" ) name in Compile := “hello" name in packageBin := “hello" name in (Compile, packageBin) := “hello"
  • 39. > referring to scopes in a build definition lazy val root = (project in file(".")) .settings( name := "hello" ) name in Compile := "hello" name in packageBin := "hello" name in (Compile, packageBin) := “hello"
  • 40. > referring to scopes in a build definition lazy val root = (project in file(".")) .settings( name := "hello" ) name in Compile := "hello" name in packageBin := "hello" name in (Compile, packageBin) := "hello"
  • 41. > scalacOptions scalacOptions ++= Seq( "-encoding", "UTF-8", "-unchecked", "-deprecation", "-Ywarn-dead-code" )
  • 42. > scalacOptions scalacOptions ++= Seq( "-encoding", "UTF-8", "-unchecked", "-deprecation", "-Ywarn-dead-code" )
  • 43. > scalacOptions "-unchecked" "-deprecation", "-Ywarn-dead-code" ) def printListType(lst: List[AnyVal]) = lst match { case strings: List[String] => println(s"List of Strings $strList") case integers: List[Int] => println(s"List of Strings $intList") }
  • 44. > scalacOptions scalacOptions ++= Seq( "-encoding", "UTF-8", "-unchecked", "-deprecation", "-Ywarn-dead-code" )
  • 45. > scalacOptions "-deprecation" "-Ywarn-dead-code" ) NO OPTION [warn] there were three deprecation warnings; re-run with -deprecation for details WITH OPTION [warn] Foo.scala:451: method listAll in class Bar is deprecated: Don't use this method. Its super broken. [warn] Bar.listAll(user)
  • 46. > scalacOptions scalacOptions ++= Seq( "-encoding", "UTF-8", "-unchecked", "-deprecation", "-Ywarn-dead-code" )
  • 47. > scalacOptions "-Ywarn-dead-code" scala> def bar (a: Int): Int = { | return 0 | a + 10 | } :12: warning: dead code following this construct return 0 ^ bar: (a: Int)Int
  • 48. > plugins.sbt addSbtPlugin("com.eed3si9n" % "sbt-man" % "0.1.0" ) // look up scaladoc addSbtPlugin("com.eed3si9n" % "sbt-dirty-money" % "0.1.0") // clean Ivy2's cache addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6") // create a fat JAR of your project // with all of its dependencies © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 49. > assembly • Merge Strategy • Shading • Excluding JARs and files © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 50. > assembly •Merge Strategy Shading Excluding JARs and files © 2018 The Quantium Group Pty Ltd. In Commercial Confidence MergeStrategy.deduplicate verify all files have the same contents & error out otherwise MergeStrategy.first picks the first of the matching files in classpath order MergeStrategy.last picks the last one MergeStrategy.singleOrError bails out with an error message on conflict MergeStrategy.concat concatenates all matching files and includes the result MergeStrategy.filterDistinctLines also concatenates, but leaves out duplicates along the way MergeStrategy.rename renames the files originating from jar files MergeStrategy.discard discards matching files
  • 51. •Merge Strategy Shading Excluding JARs and files > assembly © 2018 The Quantium Group Pty Ltd. In Commercial Confidence lazy val root = Project( id = "example", base = file("."), dependencies = Seq( domain, magnolia ) ) .settings(setts) .settings(libraryDependencies ++= mainLibs ++ testLibs) .settings(assemblyJarName in assembly := "example.jar") .settings( assemblyMergeStrategy in assembly := { case "application.conf" => MergeStrategy.concat case x => val oldStrategy = (assemblyMergeStrategy in assembly).value oldStrategy(x) } )
  • 52. •Merge Strategy Shading Excluding JARs and files > assembly © 2018 The Quantium Group Pty Ltd. In Commercial Confidence > assembly [info] Including: scala-library-2.12.4.jar [info] Including: scala-compiler-2.12.4.jar … [info] Merging files... [warn] Merging 'META-INF/MANIFEST.MF' with strategy 'discard' [warn] Merging 'META-INF/maven/jline/jline/pom.properties' with strategy 'discard' [warn] Merging 'META-INF/maven/jline/jline/pom.xml' with strategy 'discard' [warn] Merging 'application.conf' with strategy 'concat' [warn] Merging 'rootdoc.txt' with strategy 'concat' [warn] Strategy 'concat' was applied to 2 files [warn] Strategy 'discard' was applied to 3 files [info] SHA-1: 642c5daa2bfc30a825f08fa72a51a990cac441fc [info] Packaging /Users/marina/IdeaProjects/example/target/scala-2.12/example. [info] Done packaging.
  • 53. Merge Strategy •Shading Excluding JARs and files > assembly ShadeRule.rename("x.**" -> "y.@1", …) ShadeRule.zap("a.b.c") any matched class to be removed from the resulting jar file ShadeRule.keep("x.**") rule marks all matched classes as "roots" © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 55. Merge Strategy •Shading Excluding JARs and files > assembly .settings( assemblyShadeRules in assembly := Seq( ShadeRule.rename("com.google.**" -> "org.moogle.@1").inProject ) ) © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 56. •Merge Strategy •Shading •Excluding JARs and files > assembly libraryDependencies ++= Seq( ("org.apache.spark" %% "spark-core" % "0.8.0-incubating") .exclude("commons-logging", "commons-logging") ) assemblyMergeStrategy in assembly := { case PathList("about.html") => MergeStrategy.rename case x => val oldStrategy = (assemblyMergeStrategy in assembly).value oldStrategy(x) } © 2018 The Quantium Group Pty Ltd. In Commercial Confidence
  • 57. > summary [info] Build -> Project -> Settings [info] s & tasks [info] Proxy Resolvers [info] Multi-project build [info] Scope [info] scalacOptions [info] Plugins we use [success] Total time: 45 min © 2018 The Quantium Group Pty Ltd. In Commercial Confidence