Questions tagged [sbt]

sbt is an open source build tool for Scala and Java projects, similar to Java's Maven or Ant.

  • Fast and unintrusive to build simple projects.
  • Supports multiple projects/modules, external projects and other advanced setups.
  • Configuration, customization, and extension are done in Scala.
  • Dependency management support: inline declarations, external Ivy or Maven configuration files, and manual library management.
  • Supports mixed Scala/Java projects, packages jars, generates documentation with scaladoc.
  • Plugin framework for customized integrations (i.e. web app servers, IDEs, ORMs).
  • Supports testing with ScalaCheck, specs, and ScalaTest (JUnit is supported by a plugin).
  • Continuous compilation and testing with triggered execution.
  • Accurate recompilation is done using information extracted from the compiler.
  • Starts the Scala REPL with project classes and dependencies on the classpath.
  • Parallel task execution, including parallel test execution.

Official repository at GitHub

Official website

Stack Overflow sbt Tutorial

  1. General
  2. Dependency management
  3. Multiproject builds with .sbt files
  4. Publishing
  5. Cross-building
  6. Logging
  7. Using plugins
  8. sbt-assembly
  9. Developing tasks
  10. Developing plugins
  11. Developing commands
  12. Outside sbt
9338 questions
104
votes
4 answers

How can sbt pull dependency artifacts from git?

I've heard (and I know I've seen examples too, if only I can remember where) that sbt can obtain dependencies from a git repo. I am looking to obtain the dependency harrah/up from github. The repository does not provide any artifact JAR files, only…
Owen
  • 36,566
  • 13
  • 87
  • 116
101
votes
4 answers

Can someone explain the right way to use SBT?

I'm getting out off the closet on this! I don't understand SBT. There, I said it, now help me please. All roads lead to Rome, and that is the same for SBT: To get started with SBT there is SBT, SBT Launcher, SBT-extras, etc, and then there are…
Jack
  • 15,582
  • 17
  • 86
  • 162
99
votes
11 answers

How to specify JVM maximum heap size "-Xmx" for running an application with "run" action in SBT?

My application does large data arrays processing and needs more memory than JVM gives by default. I know in Java it's specified by "-Xmx" option. How do I set SBT up to use particular "-Xmx" value to run an application with "run" action?
Ivan
  • 59,167
  • 87
  • 235
  • 370
98
votes
4 answers

How to compile tests with SBT without running them

Is there a way to build tests with SBT without running them? My own use case is to run static analysis on the test code by using a scalac plugin. Another possible use case is to run some or all of the test code using a separate runner than the one…
user1809090
  • 1,781
  • 1
  • 12
  • 6
95
votes
5 answers

How to see dependency tree in sbt?

I am trying to inspect the SBT dependency tree as described in the documentation: sbt inspect tree clean But I get this error: [error] inspect usage: [error] inspect [uses|tree|definitions] Prints the value for 'key', the defining scope,…
Cherry
  • 25,428
  • 40
  • 160
  • 286
93
votes
3 answers

How to build an Uber JAR (Fat JAR) using SBT within IntelliJ IDEA?

I'm using SBT (within IntelliJ IDEA) to build a simple Scala project. I would like to know what is the simplest way to build an Uber JAR file (aka Fat JAR, Super JAR). I'm currently using SBT but when I'm submiting my JAR file to Apache Spark I get…
Yves M.
  • 26,153
  • 20
  • 93
  • 125
93
votes
1 answer

How run sbt assembly command without tests from command line?

I have read questions: this and that. They suggest to modify sbt file. But I want run sbt clean assembly without tests and do not modify sbt build files. Is it possible with sbt? In maven there is -DskipTest=true parameter, is there analog for sbt?
Cherry
  • 25,428
  • 40
  • 160
  • 286
92
votes
10 answers

How to set heap size for sbt?

I am using SBT 0.12.0. I have read other answers on stack overflow and followed them, however none of them helps, for example: create ForkRun class - I have not observed any forked process during my usage of sbt set environment variable JAVA_OPTS -…
user972946
91
votes
2 answers

Class broken error with Joda Time using Scala

I'm adding the Joda Time repository to SBT with libraryDependencies ++= Seq( "joda-time" % "joda-time" % "2.1" ) Then I merrily use it like this: val ymd = org.joda.time.format.DateTimeFormat.forPattern("yyyyMMdd") …
Jack
  • 15,582
  • 17
  • 86
  • 162
86
votes
2 answers

SBT Test-Dependencies in Multiprojects: Make the Test-Code Available to Dependent Projects

I've a SBT multi-project where some projects have dependencies to each other. Like this: lazy val coreProject: Project = Project( id = "core-project", base = file("./core-project"), // other stuff )) lazy val extensions: Project…
Gamlor
  • 12,185
  • 6
  • 40
  • 68
85
votes
16 answers

How to use sbt from behind proxy?

How do I configure sbt to use a proxy? For example, my build definition needs to connect to GitHub, specifying connection parameters for http.proxy, http.proxyPort, user, and password. How would I pass in these settings to sbt? Is there an easy way…
supyo
  • 2,949
  • 2
  • 18
  • 35
83
votes
4 answers

An easy way to get rid of *everything* generated by SBT?

Is there an easy way to get rid of everything getting generated as a result of performing an SBT build? It turns out it creates target directories all over the place. Performing sbt clean clean-cache clean-lib clean-plugins ... doesn't get rid of…
Wilfred Springer
  • 10,593
  • 4
  • 49
  • 69
82
votes
2 answers

How to manage multiple interdependent modules with SBT and IntelliJ IDEA?

I'm developing several modules with dependencies among them, and would like to work with them all together in one IDEA project. I'm using sbt-idea to generate IDEA projects from the sbt build definitions, which works great for individual projects. …
David Soergel
  • 1,679
  • 1
  • 11
  • 14
82
votes
10 answers

SBT Error: "Failed to construct terminal; falling back to unsupported..."

I have run into an ERROR with SBT today. It can best be shown with the sbt sbt-version command: Run on 5/29/17: eric@linux-x2vq:~$ sbt sbt-version Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256M; support was removed in…
ericky
  • 1,591
  • 2
  • 12
  • 16
79
votes
9 answers

How to prevent java.lang.OutOfMemoryError: PermGen space at Scala compilation?

I have noticed a strange behavior of my scala compiler. It occasionally throws an OutOfMemoryError when compiling a class. Here's the error message: [info] Compiling 1 Scala source to…
BumbleGee
  • 1,953
  • 3
  • 17
  • 17