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
47
votes
5 answers

Adding Play JSON Library to sbt

How can I add the Play JSON library (play.api.libs.json) to my sbt project? When I added the following to my plugins.sbt file: addSbtPlugin("play" % "sbt-plugin" % "2.1.0") I faced this error: [warn] …
Kevin Meredith
  • 41,036
  • 63
  • 209
  • 384
46
votes
4 answers

"Unknown artifact. Not resolved or indexed" error for scalatest

I'm trying to modify the build.sbt file to add scalatest dependencies in IntelliJ IDEA. There's no error log in the console but I got a Unknown artifact. Not resolved or indexed. when I hovered my mouse over the underline. How do I solve this? Many…
user3474606
  • 515
  • 1
  • 6
  • 15
45
votes
2 answers

Idea, sbt, unable to reparse warning

I've pushed my artifact to oss nexus repo, added it as dependency to another project. Idea keeps me warning: [warn] Unable to reparse com.github.kondaurovdev#jsonapi_2.11;0.1-SNAPSHOT from sonatype-snapshots, using Fri May 13 17:12:52 MSK 2016…
Alexander Kondaurov
  • 3,677
  • 5
  • 42
  • 64
45
votes
3 answers

How to set system properties for runMain on command line?

How can I set a system property for runMain upon executing it from command line on Windows? I'd like to be able to run the following command: sbt -Dconfig.resource=../application.conf "runMain akka.Main com.my.main.Actor" Regardless of whether fork…
Chad Retz
  • 1,241
  • 2
  • 14
  • 16
44
votes
5 answers

Setting up sbt to use Java 7 for compilation?

I'm getting compile errors when running the compile task as the sources reference new classes in java.nio.file package that only appeared in Java 7. I have the following in build.sbt: javaHome := Some(file("/opt/jdk/jdk1.7.0")) fork := true In…
Nick A Miller
  • 1,325
  • 1
  • 13
  • 20
44
votes
8 answers

Migrating from Maven to SBT

As you know, SBT is compatible with Maven in some way -- SBT recognizes simple Maven POMs and can use dependencies and repositories specified in them. However, SBT wiki says that, if inline dependency is specified in SBT project definition, POM will…
Vasil Remeniuk
  • 20,519
  • 6
  • 71
  • 81
43
votes
8 answers

How to work efficiently with SBT, Spark and "provided" dependencies?

I'm building an Apache Spark application in Scala and I'm using SBT to build it. Here is the thing: when I'm developing under IntelliJ IDEA, I want Spark dependencies to be included in the classpath (I'm launching a regular application with a main…
Alexis Seigneurin
  • 1,433
  • 2
  • 15
  • 20
43
votes
2 answers

What is the difference between ThisBuild and Global scopes?

Can someone explain me the difference between writing these 2 lines: resolvers in ThisBuild ++= appResolvers resolvers in Global ++= appResolvers
Sebastien Lorber
  • 89,644
  • 67
  • 288
  • 419
43
votes
2 answers

Scala sbt console - code changes not reflected in sbt console

I use scala sbt console to test my methods. (commands : sbt then console) But the code changes done in eclipse or other external editor, are not getting reflected in the sbt console. Every time, I have to quit the console (using Crt + D) and again…
Karthik Chandraraj
  • 1,051
  • 2
  • 14
  • 27
42
votes
3 answers

Exception in Intellij's SBT Console: not found: value ideaPort ideaPort in Global := 49516

After a System Crash the sbt-console of Intellij 2019.1 can not start: The following Exception is thrown: :1: error: not found: value ideaPort ideaPort in Global := 49516 Strangely another project just works fine. I removed .idea with no…
pme
  • 14,156
  • 3
  • 52
  • 95
42
votes
2 answers

build.sbt: how to add spark dependencies

Hello I am trying to download spark-core, spark-streaming, twitter4j, and spark-streaming-twitter in the build.sbt file below: name := "hello" version := "1.0" scalaVersion := "2.11.8" libraryDependencies += "org.apache.spark" %% "spark-core" %…
Bobby
  • 537
  • 1
  • 5
  • 14
42
votes
1 answer

How to change Scala version for sbt project?

How can I change Scala version in a sbt project? I would like SBT to check whether the system's Scala version is correct and if it is not the case then download it.
Łukasz Lew
  • 48,526
  • 41
  • 139
  • 208
42
votes
7 answers

How to include an external jar file into the jar with package?

My project has dependency on an external jar. I have created a directory lib and have copied the jar file into it. This is my build.sbt: name := "approxstrmatch" version := "1.0" scalaVersion := "2.10.4" unmanagedJars in Compile +=…
user3803714
  • 5,269
  • 10
  • 42
  • 61
42
votes
2 answers

What are key differences between sbt-pack and sbt-assembly?

I've just stumbled upon the sbt-pack plugin. The development stream seems steady. It's surprising to me as I believed that the only plugin for (quoting sbt-pack's headline) "creating distributable Scala packages." is sbt-assembly (among the other…
Jacek Laskowski
  • 72,696
  • 27
  • 242
  • 420
41
votes
1 answer

How to see all the warnings in SBT 0.11?

I get notified about "unchecked" warnings when I compile my Scala project with SBT 0.11, but I can't see the warnings themselves. What I see is [warn] there were 8 unchecked warnings; re-run with -unchecked for details [warn] one warning found What…
Ivan
  • 63,011
  • 101
  • 250
  • 382