SBT runner for TeamCity

If you use the power of Scala in your projects then we have news you may find interesting.

We have created a plugin for TeamCity that natively supports SBT builds which means you can build the code and run tests with TeamCity and see the results in a handy way. When SBT runner is installed into your TeamCity server all you need is to pick ‘Simple Build Tool (Scala)’ runner when creating a new build step for your build configuration. Default ‘Auto’ installation mode provides latest version of SBT on every TeamCity agent your build will be running on. No additional actions from your side are required. Add the commands you like to run and enjoy the results.

Auto mode

If something goes wrong, e.g. compilation errors occur or tests fail, you will see the details in an easy to read form.

error in compilation

tests view

If you have pre-installed SBT manually you can choose ‘Custom’ mode and specify path to SBT home directory.

Custom mode

In this mode you need to install sbt-teamcity-logger either as a plugin for your project or as a global plugin for your SBT installation. You can find more details on GitHub.

In fact, the whole support for SBT builds consists of two independent parts.

  1. TeamCity plugin that provides convenient way of setting up build step for the configuration, and

  2. SBT plugin that wraps SBT native messages in the way TeamCity can consume and understand.

In case you cannot install the plugin to your TeamCity server, you still have a way to get reporting for SBT builds. Add sbt-teamcity-logger to your project or SBT installation as mentioned above and create ‘Ant’ build step that will run SBT as a regular java process. Build results will be shown in handy way.

SBT runner is available for the latest TeamCity versions. Download it for TeamCity 8.0 or for TeamCity 8.1. Try it out and let us know what you think!.

Comments below can no longer be edited.

14 Responses to SBT runner for TeamCity

  1. Avatar

    Clint Munden says:

    February 18, 2014

    I am trying out the SBT Runner plugin (for TeamCity 8.1) but I get the following message when adding builds to the queue “Incompatible runner: Simple Build Tool (Scala)”. The build sits in the queue and doesn’t start any of my TeamCity cloud agents.

    What am I missing?

    Best Regards,
    Clint Munden

    • Avatar

      Ekaterina Shliakhovetskaja says:

      February 28, 2014

      If you still experience this problem could you please send us TeamCity agent logs via our issue tracker (http://youtrack.jetbrains.com/issues/TW)?
      Thank you!

  2. Avatar

    Justin says:

    May 20, 2014

    I’m currently evaluating TeamCity with sbt, but I can’t quite get this sbt runner to work. The auto mode runs, but won’t detect my settings in ~/.sbt, which I require for resolver config and publish credentials.

    For the custom config, it is not clear to me how to set it up. I tried using both the sbt directory installed on the system by yum as well as a version installed in the home directory.

    • Avatar

      Ekaterina Shliakhovetskaja says:

      May 20, 2014

      Hi Justin,

      Thank you for giving TeamCity a chance 🙂
      In ‘Auto’ mode the SBT runner downloads latest SBT version and runs it in isolation, so no your local configs are used. In ‘custom’ mode you should provide a path to SBT installation directory located on the agents where the build will be running. SBT runner will launch ‘sbt-launch.jar’ from /bin folder under that directory. Default Java options that will be used you can see and change within SBT runner build step settings. SBT itself will use ~/.sbt directory for further configs. At the moment we don’t support running sbt with command line script but we are considering it ( http://youtrack.jetbrains.com/issue/TW-34977).
      You can contact me directly at shkate at jetbrains if you have other questions.


  3. Avatar

    Piotr says:

    August 4, 2014


    I wanted to give it a try, I set it up for auto installation type but when I try to execute a sbt test I get error. It starts by downloading sbt, then scala but it fails with
    [info] Resolving org.scala-sbt#precompiled-2_9_3;0.12.3 …
    [14:22:42][Step 1/1] [info] Resolving org.scala-sbt#precompiled-2_10_1;0.12.3 …
    [14:22:43][Step 1/1] [info] Done updating.
    [14:22:43][Step 1/1] [error] java.lang.NoClassDefFoundError: sbt/std/InitializeInstance$
    [14:22:43][Step 1/1] [error] Use ‘last’ for the full log.

    Can you tell what am I missing?


    • Avatar

      Ekaterina Shliakhovetskaja says:

      September 22, 2014

      Hi Piotr,

      I am sorry for delay with answer, I’ve missed your comment somehow. If you are still interesting in SBR runner and have problem with it you can contact me directly at shkate at jetbrains.com. The problem could be caused by version incompatibility but it is better to have a closer look.

      Looking forward to hearing from you.


  4. Avatar

    Chen Wei says:

    September 19, 2014

    I have a sbt project and a sub-project called “backend”. Before using TeamCity, I build it by typing “sbt backend/compile” in the terminal under the root of the project. However, when I input “backend/clean backend/compile” in the “Commands execute” text field, it generates following errors.

    [20:04:23][Step 1/1] [error] Expected ID character
    [20:04:23][Step 1/1] [error] Not a valid command: backend (similar: append)
    [20:04:23][Step 1/1] [error] Expected project ID
    [20:04:23][Step 1/1] [error] Expected configuration
    [20:04:23][Step 1/1] [error] Expected ':' (if selecting a configuration)
    [20:04:23][Step 1/1] [error] Expected key
    [20:04:23][Step 1/1] [error] Not a valid key: backend (similar: package, packageBin, package-bin)
    [20:04:23][Step 1/1] [error] backend/clean
    [20:04:23][Step 1/1] [error]        ^
    [20:04:23][Step 1/1] Process exited with code 1
    [20:04:23][Step 1/1] Step backend (Simple Build Tool (Scala)) failed
  5. Avatar

    Ekaterina Shliakhovetskaja says:

    September 22, 2014

    Hi Chen,

    I am sorry for the inconvenience. At the moment SBT runner doesn’t support project name as prefix for command. I’ve created an issue in our tracker http://youtrack.jetbrains.com/issue/TW-37967. You can start watching it to be notified as soon as it will be fixed. For now I can only mention ‘working directory’ option where you can set ‘backend’ and then ‘clean’ and ‘compile’ commands will be running there.


  6. Avatar

    Roman says:

    November 24, 2014


    I’m trying to build my project using teamcity SBT plugin, but I get this error.

    [Scala compiler] Unable to locate an executable at “/Applications/TeamCity/buildAgent/temp/agentTmp/agent-sbt/bin/javac” (-1)
    [17:17:39][Step 2/2] (compile:compile) javac returned nonzero exit code
    [17:17:39][Step 2/2] Process exited with code 1
    [17:17:39][Step 2/2] Step SBT (Simple Build Tool (Scala)) failed

    SBT is installed in ‘Auto’ mode, javac is in PATH, JAVA_HOME is set

  7. Avatar

    Joe says:

    February 12, 2015

    Same error in the build plugin, it is looking for Java compiler in the wrong location. To start with it should be $JAVA_HOME, but it is looking in the buildAgent/temp/agentTmp/agent-sbt/bin folder, which should really just be a classpath arg.

    Notes: this is on OSX, runs fine on Linux agent.

    • Avatar

      Danny says:

      February 27, 2015

      Got the same problem on FreeBSD 10.1.
      It says that Java home was set to the correct path but when maven tries to fetch a dependency it looks in set home.

      • Avatar

        Danny says:

        February 27, 2015

        btw: Problem started when I was adding sbt-phantomjs to my project.

  8. Avatar

    Matt says:

    February 25, 2015

    It would be great if we could configure the runner with a proper SBT configuration. Working in a bank, our agents can’t get out of the proxy, so we have our own internal maven-central replication. It would be nice if we could setup SBT centrally on the server.

    • Avatar

      Oleksii says:

      February 27, 2015

      We use aggregate repo from our internal nexus maven repo. All our sbt projects use that repo’s url as a resolver. In nexus you can configure proxy settings in every proxy repository. Let me know if this could solve your problem.

Discover more