O'Reilly logo

Building Applications with Scala by Diego Pacheco

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding dependencies

Like any build tool, SBT allows you to resolve dependencies. SBT uses the Ivy / Maven2 patterns to resolve dependencies. So, if you are familiar with Maven2, Gradle, or Ant/Ivy, you will realize that setting SBT dependencies is the same, although with a different syntax. Dependencies are defined in the build.sbt file. There is no Scala development without unit tests. One of the most popular testing libraries is JUnit (http://junit.org/junit4/). JUnit works with Java and Scala projects. SBT will download and add JUnit to your Scala application classpath parameter. We need to edit the build.sbt file to add JUnit as a dependency as follows:

 build.sbt name := "hello-world-sbt" version := "1.0" scalaVersion := "2.11.7" scalaVersion ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required