SBuild - A Scala-based Build System

The magic-free yet powerful build tool.

We are in the process of migrating content to the a new page: Please visit the new page and give feedback!

SBuild is a very fast, powerful and flexible build tool. It can be used to build anything you want and does not force any style, but its main target are all Java VM targeted projects. The main "script language" of SBuild is Scala. SBuild is a dependency-driven tool, so it will only do what is necessary, to build your requested target, nothing more and nothing less. SBuild can detect unchanged targets and dependencies, and will avoid doing the same task multiple times, if nothing has changed.

With SBuild as the driving DSL, you have the full power of the Scala programming language to build your projects and artifacts. Of course, you can easily use all existing Ant tasks, but through SBuilds Ant Wrappers this is eaven easier.


  • Platform independence
  • Fast and multihreaded
  • Built-in multi project support with automatic cross-project dependency resolving
  • Automatic up-to-date detection and avoidance of unnecessary work
  • Flexible scheme handler mechanism, providing e.g. Maven repository support, HTTP resource support
  • Plugin support
  • Ant task integration - Reuse all existing Ant tasks
  • Simple to use "syntax" which require almost no Scala knowledge
  • Full power of turing-complete Scala language
  • Eclipse Integration
  • Support for declarative and imperative build setups


Current version of SBuild is 0.7.1: Current version of SBuild Eclipse Plugin is 0.4.2:

Other Downloads
Release History



You want to get part of SBuild development? You want to report a Bug or an idea?

Welcome! We are happy to have you aboard.

You can use the following resources to collaborate and contribute:
  • Mailing list: sbuild-dev, sbuild-user
  • Bug tracker - Search and report bugs and feature request, comment if you can reproduce issues or know how to fix them, provide patches...

Previously, we also had a forum, which can be viewed but no longer edited in favour of our mailing lists.

Why not Ant or Make?

Apache Ant is very powerful and cross platform, but unfortunately XML, you can not program in XML, but if you try the result is very ugly and limited. SBuild provides basic support to call Ant Tasks. In fact, SBuild might be a lot more useful if existing Ant tasks were used. Also, SBuild ships with a set of Ant wrappers, that make the usage of Ant tasks as easy as with XML.

GNU Make is based on a native shell to execute its targets, the resulting Makefiles are not cross platform.

As the Java Platform is in need for a powerful buildsystem and a good buildsystem should be owned by the developer, the best language of the buildscript should be a native JVM Language, mainly Java. Unfortunately, Java is very verbose and writing build scripts in Java is - although possible - not very elegant and not better to read than Ant files. Groovy whould be a good candidate, but Groovy is not a statically typed language for the JVM, so various type errors will only crash at runtime. This might be too late (especially, as some pathes in a build system are called less frequent than others), at least if there are better alternatives, and there are... Scala feels like a scripting language and is statically typed. You can write very concise and elegant build scripts, so the decision was easy.


SBuild is dependency-driven. This means, the user says what she wants, SBuild determines all necessary action to do to get there.

All knowledge about your project is read from the buildfile, per default SBuild.scala. In that buildfile, one can setup a project by defining Targets and Dependencies, a concept already known from other build tools like Apache Ant or GNU Make.

Targets describe real resources in the local file system. Up-to-date detection will be based on time stamps. Target names are interpreted as file names relative to the project directory (the directory containing the build file). Phony targets are targets, that are not related to a filesystem resource, e.g. "clean" or "compile". Those targets are prefixed with "phony:". Because phony targets are not related to file system resources, the up-to-date detection for phony targets is less clever. Dependency chains which contain phony targets will therefore always run. (But there are some concepts to avoid unneeded work, see TargetContext.)

Targets have a name that represents a unique resource. Target names support prefixes which are called schemes. Besides the file scheme, which is the default when non was given and selects a resource in the local filesystem, and the phony namespace, SBuild supports any number of additional namespaces by registering scheme handlers. A registered scheme handler has to translate the target name into a name with the file or phony scheme. If such a resource is missing and SBuild needs it to fulfil the dependencies of a target, the scheme handler is asked to resolve the resource. One example is the MvnSchemeHandler that might resolve the mvn scheme and resolve missing Maven dependencies by downloading them to the local repository.

Hello World

Here is a simple Hello World Project printing a greeting.

The SBuild.scala file looks like this:

 1import de.tototec.sbuild._
 3class SBuild(implicit _project: Project) {
 5  Target("phony:hello") help "Say hello" exec {
 6    println("Hello!")
 7  }

We defined one target, so let's check:

bash$ sbuild --list-targets
Compiling build script: /tmp/SBuild.scala...
hello    Say hello

(The first output line tells us that SBuild compiled the buildfile automatically, because it has changed.)

SBuild will print a list of all available targets in that buildfile and the provided help message, if any.

Now let's run sbuild on the command line with the hello target:

bash$ sbuild hello
Calculating dependency tree...
[0%] Executing...
[0%] Executing target: hello
[0%] Say hello
[100%] Execution finished. SBuild init time: 212 msec, Execution time: 9 msec

This time, SBuild skipped the compilation phase and did directly what you asked for. Those lines starting with a percent in square brackets will tell you the overall progress of the build and the currently executed target. The last line will present some information about the execution time. In the example above, SBuild took 224 milliseconds to initialize itself, read the buildfile and calculate the dependency tree. The execution, in this case the execution of the echo target, took 9 milliseconds.