3 Scala Build Tool (sbt)

 

After reading this lesson, you’ll be able to

  • Run commands in sbt
  • Create an sbt project
  • Describe the structure of the files of a Scala project built with sbt

In the previous lesson, you learned how to evaluate snippets of code using the Scala REPL. Programs have several components: they depend on other modules and libraries, and they are structured in multiple files and folders. In this lesson, you’ll discover the basics of the Scala Build Tool, sbt. You’ll compile and run your first Scala program on the JVM using sbt. In this book, you’ll use sbt to manage dependencies, compile your code, and run your Scala programs.

3.1 Why sbt?

You can build Scala projects using several build tools such as Maven, Ant, and Gradle, but sbt is the most common build tool in the community. It is a complex but powerful tool that manages your dependencies, and it defines the build cycle of your code. sbt has its syntax and predefined instructions. You can also load plugins, which are programs written using the sbt syntax, to add new commands or modify the build process’s existing behaviors. Throughout this book, you are going to write Scala programs that use the default sbt configuration. You are not going to learn about its advance uses and functionalities in this book, but you can look at its documentation at www.scala-sbt.org if you’d like to learn more about it.

3.2 sbt installation

 
 
 

3.3 sbt commands

 

3.4 Your first sbt project

 
 
 

3.5 sbt project structure

 
 

Summary

 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest