Chapter 17. Building Projects with sbt
Although you can use tools like Ant, Maven, and Gradle to build your Scala projects, sbt—originally named Simple Build Tool—is the de facto build tool for Scala applications. sbt makes the basic build and dependency management tasks simple and lets you use the Scala language itself to conquer more difficult tasks.
sbt uses the same directory structure as Maven, and like Maven, it uses a “convention over configuration” approach that makes the build process incredibly easy for basic projects. Because it provides a well-known, standard build process, if you work on one Scala project that’s built with sbt, it’s easy to move to another project that also uses sbt. The project’s directory structure will be the same, and you’ll know that you should look at the build.sbt file and the optional project/*.sbt files to see how the build process is configured.
Starting with version 1.3.0, sbt began using Coursier for library management, a task the Coursier website refers to as artifact fetching. Prior to 1.3.0, sbt used Apache Ivy for this task, but Coursier aims to be a faster alternative. When you specify managed dependencies in your build.sbt file, Coursier is the tool that retrieves the JAR files for you.
In addition to handling managed dependencies, you can also place unmanaged dependencies—plain old JAR files—in your project’s lib folder, and sbt will automatically find them.
As a result of all these features, with very little effort on your part, ...
Get Scala Cookbook, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.