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
9905 questions
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,709
  • 1
  • 11
  • 15
81
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
  • 2,031
  • 3
  • 18
  • 18
81
votes
3 answers

How to set main class in build?

Upon sbt run I have multiple choices of main class. I would like to set a main class so I've writen in build.sbt: mainClass := Some("aMainClass") But sbt fails with: build.sbt:1: error: not found: value aMainClass I've also tried with…
user312728
  • 981
  • 1
  • 7
  • 7
81
votes
4 answers

SBT doesn't find file in local maven repository although it's there

I'm having problems with a maven dependency which is in my local respository. SBT can't find it. Already set log level to debug, but not getting anything new. The files are in the repository. I copy paste paths from the console to file explorer and…
User
  • 31,811
  • 40
  • 131
  • 232
77
votes
6 answers

how do I get sbt to use a local maven proxy repository (Nexus)?

I've got an sbt (Scala) project that currently pulls artifacts from the web. We'd like to move towards a corporate-standardized Nexus repository that would cache artifacts. From the Nexus documentation, I understand how to do that for Maven…
Harlan
  • 18,883
  • 8
  • 47
  • 56
76
votes
6 answers

Enforcing Java version for Scala project in sbt?

My scala application will only run with Java 7 as it depends on libraries that only appeared in that version of the JDK. How do I enforce that in sbt, so that the correct error message is shown immediately to the user if she is using the wrong…
Henry Story
  • 2,116
  • 1
  • 17
  • 28
74
votes
3 answers

sbt: How can I add a local filesystem jar to my project?

I have a library compiled to a jar (not an sbt project, just the jar file) that's not available on a repository. Is there a simple way to add a reference to the jar in the filesystem/project directly?
Jeff Axelrod
  • 27,676
  • 31
  • 147
  • 246
72
votes
14 answers

IntelliJ Cannot Import sbt Project

I have upgraded IntelliJ to version CE 2017.3 from a CE 2017.2.5, and now I cannot build my sbt project. The build gets stuck on the first step: "Build: sync MyProjName: syncing... dump project structure from sbt" I have deleted the .idea…
radumanolescu
  • 4,059
  • 2
  • 31
  • 44
69
votes
3 answers

Can I access my Scala app's name and version (as set in SBT) from code?

I am building an app with SBT (0.11.0) using a Scala build definition like so: object MyAppBuild extends Build { import Dependencies._ lazy val basicSettings = Seq[Setting[_]]( organization := "com.my", version := "0.1", …
Alex Dean
  • 15,575
  • 13
  • 63
  • 74
68
votes
4 answers

SBT: Start a command line 'run' of the main class of a non-default project

I am starting to use sbt build my Scala code (and handle dependencies). As far as I know if I use $ sbt run on the command line this will run the main class of the main project. Is it possible to 'run' within any other project from the…
fgysin
  • 11,329
  • 13
  • 61
  • 94
68
votes
9 answers

SBT compilation for play framework 2.x disabled by default

I created a new Play Framework project using the activator, activator new my-project-name and then I selected the play-java template and the project is created with no errors. Then I import the project into my IDE, IntelliJ, as a SBT project. When…
dazito
  • 7,740
  • 15
  • 75
  • 117
67
votes
4 answers

How do you remove the _ postfix from artifacts built+published with simple-build-tool?

I'm building a few Java-only projects using simple-build-tool. When I publish the artifacts from the projects using, say, sbt publish-local then the resulting artifacts have the Scala version appended to their name. With a Scala project this would…
James
  • 3,312
  • 1
  • 21
  • 15
67
votes
2 answers

What's recommended .gitignore for Scala/sbt project in IntelliJ IDEA?

I created a new Scala/sbt project in IntelliJ IDEA 13. Since other team members will be working on this project (presumably with other IDEs), what should I put in the .gitignore? It seems some of the project dependencies are defined in the .idea…
anshumans
  • 4,045
  • 2
  • 18
  • 25
66
votes
6 answers

How to publish jar to local repository?

I have a library compiled to a jar (not an sbt project, no source code, just the jar file) that's not available on a repository. Is there a way to publish the jar locally so I can add the dependency using the libraryDependencies += "org.xxx" %…
Jeff Axelrod
  • 27,676
  • 31
  • 147
  • 246
64
votes
5 answers

Install sbt on ubuntu

I have installed sbt on Ubuntu. :~/bin/sbt/bin$ ls classes sbt sbt-launch.jar target jansi.jar sbt.bat sbt-launch-lib.bash win-sbt However, whenever I try to launch sbt (from the same directory where sbt is located) it does not…
NoIdeaHowToFixThis
  • 4,484
  • 2
  • 34
  • 69