Want to take your software engineering career to the next level? Join the mailing list for career tips & advice Click here

sbt

sbt, the interactive build tool

Subscribe to updates I use sbt


Statistics on sbt

Number of watchers on Github 4145
Number of open issues 667
Average time to close an issue 8 days
Main language Scala
Average time to merge a PR 2 days
Open pull requests 124+
Closed pull requests 49+
Last commit 2 months ago
Repo Created about 11 years ago
Repo Last Updated 2 months ago
Size 23.8 MB
Homepage https://scala-sbt...
Organization / Authorsbt
Latest Releasev1.3.13
Contributors137
Page Updated
Do you use sbt? Leave a review!
View open issues (667)
View sbt activity
View on github
Book a Mock Interview With Me (Silicon Valley Engineering Leader, 100s of interviews conducted)
Software engineers: It's time to get promoted. Starting NOW! Subscribe to my mailing list and I will equip you with tools, tips and actionable advice to grow in your career.
Evaluating sbt for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

Build Status Latest version Gitter Chat

sbt

sbt is a build tool for Scala, Java, and more.

For general documentation, see https://www.scala-sbt.org/.

sbt 1.x

This is the 1.x series of sbt. The source code of sbt is split across several GitHub repositories, including this one.

  • sbt/io hosts sbt.io module.
  • sbt/librarymanagement hosts sbt.librarymanagement module that wraps Ivy.
  • sbt/zinc hosts Zinc, an incremental compiler for Scala.
  • sbt/sbt, this repository hosts modules that implements the build tool.

Other links

  • Setup: Describes getting started with the latest binary release.
  • FAQ: Explains how to get help and more.
  • sbt/sbt-zero-seven: hosts sbt 0.7.7 and earlier versions

Issues and Pull Requests

Please read CONTRIBUTING carefully before opening a GitHub Issue.

The short version: try searching or asking on StackOverflow.

license

See LICENSE.

sbt open issues Ask a question     (View All Issues)
  • almost 4 years Feature Request: test:clean
  • almost 4 years sbt run fails in this trivial example
  • almost 4 years Camel Context keeps hanging and executing after "run" ends
  • almost 4 years [0.13.13] test class autocompletion broken
  • almost 4 years Can't Publish Ivy & Maven Metadata Simultaneously
  • almost 4 years Change cross-version source directory support to use CrossVersion.binary instead of CrossVersion.partialVersion
  • almost 4 years [sbt 0.13.13] incorrect deprecated message
  • almost 4 years Cannot access an artifactory repo protected by HTTP basic authentication on Windows
  • almost 4 years sbt 0.13.13.tgz has a different directory layout than 0.13.12.tgz
  • almost 4 years Docs inconsistent about where to put sonatype.sbt
  • almost 4 years updateSbtClassifiers fails when scalaOrganization is set to org.typelevel
  • almost 4 years Errors running sbtRoot/compile:doc
  • almost 4 years sbt-datatype: more natural JSON encoding of ADTs
  • almost 4 years Concurrent processing of run
  • almost 4 years Concurrent processing of settings
  • almost 4 years Job list
  • almost 4 years Background run (bgrun)
  • almost 4 years Abstract "console" task over JSON
  • almost 4 years Abstract "run" task over JSON
  • almost 4 years JSON encoding for useful tasks and settings
  • almost 4 years Abstract compile output over JSON
  • almost 4 years Abstract logging output over JSON
  • almost 4 years Split terminal output per-channel
  • almost 4 years Channel cursor
  • almost 4 years Minimal sbt thin client
  • almost 4 years GraphQL-like frontend for sbt-datatype
  • almost 4 years Conflict with internal SBT dependencies
  • almost 4 years Require scalaVersion
  • almost 4 years ivy-home in sbt.conf not respected by sbt-launcher
  • almost 4 years Scala 2.10 build failure when using sbt 0.13.12 or higher
sbt open pull requests (View All Pulls)
  • Fixes #2464. Actually reorganize appResolvers
  • Don't drop JCenter when useJCenter is false
  • FPORT: Avoid CCE when scalac internally uses compileLate
  • FPORT: Add a pending test for a modified member of a trait
  • Use scripted engine from sbt/util
  • FPORT: Inter-project dependency tracking
  • Update version to 0.13.11-SNAPSHOT
  • Upgrade to latest sbt/librarymanagement
  • FPORT: Consider signatures of methods before and after erasure in ExtractAPI
  • FPORT: Refix snapshots
  • FPORT: Maven compatibility changes (intransitive warnings and "configuration not public")
  • FPORT: Make sbt aware of Dotty
  • FPORT: Assorted incremental compiler bug fixes
  • Enable mavenResolverPlugin scripted w/ new sbt/librarymanagement
  • FPORT: Make JCenter opt in
  • (Do not merge) Fixes sbt/sbt#2264. Use explicit artifacts if any, fallback to hardcoded
  • Improve time measuring capabilities (1.0.X)
  • Implement `projects` for .sbt files
  • Publish compiler interface to an alternate local repository for Scripted tests
  • Keep roots when cleaning
  • Add POM props missing from ScmInfo/Developer
  • Add Ivy `branch` support to ModuleID
  • Allow test framework to provide test names
  • Invalidate macro providers whose transitive dependencies have been recompiled
  • Add support for external apidoc URLs for both Scala and Java projects.
  • Add javaScalaCompiler task
  • Macrotracker support
  • Registering dependencies on auxiliary (non-scala) files
  • Events reported by forked tests should be sequence of (String, SuiteResult)
  • Add Append & Remove instances for Option
  • Fix instability of self variable API representation
  • Make moduleConfigurations a TaskKey
  • Fix sbt/sbt#2431
  • Fix a few typos
  • FPORT: Inter-project dependency tracking
  • Native script support
  • Improve performance for DefaultParsers.validID(String)
  • Fix for https://github.com/sbt/sbt/issues/2254
  • [sbt 1.0] Reduce sbt.Project(...) params and make settings(...) lazy
  • Static launcher, get bridge sources from resources
  • BPORT: Include used types in the set of used names
  • (WIP) Attempt at fixing sbt/sbt#2435
  • [sbt 1.0] Refactoring
  • FPORT: Avoid CCE when scalac internally uses compileLate. Fixes #2452
  • FPORT: Completion for build-level keys
  • Support repositories override in static launcher
  • Change ivy home when running scripted tests
  • Simplify EvaluateSettings and INode
  • Rework DefinesClass lookup.
  • Override scala organization and version transitively at the Ivy level
  • Add new SBT global setting asciiGraphWidth
  • Fix typo: paralleism -> parallelism
  • FPORT: Fix for sbt/sbt#2435
  • Workaround for inclusion of ScalaCheck classes in scala-partest-extras.jar
  • Make publishTo & otherResolvers TaskKey's
  • Fixes #2686 by resetting scalaVersion for updateSbtClassifiers
  • Fix for #2686
  • Tests for scalaOrganization + patches (do not merge yet)
  • Adds templateResolvers and `new` command
  • [sbt 0.13] Configure scripted to do less
  • Configurable explicit list of artifacts for Scala binary version check
  • Allow single-letter aliases
  • Workaround #1696 & bump to JDK 1.8
  • Fix #2766 sourceFile null causes NPE
  • Deprecate tuple enrichments. Fixes #2763
  • [sbt 1.0] server reboot
  • Add new param to javadoc.run due to interface change
  • Remove ProcessExtra and the use of java.lang.ProcessBuilder
  • Add build-level keys to the tab completion
  • JUnitXmlTestsListener now correctly flags ignored, skipped and pending tests
  • Back out build-level key completion
  • Add props to define source dependencies on io/util/lm/zinc
  • Error message and Syntax
  • [fport] Fix #2677: Tags.ForkedTestGroup doesn't work
  • [fport] Loading performance
  • Use Scala 2.12.1
  • Fixes Issue #3154 - "It is not a test" in JUnit XML reports.
  • Add parallel batch mode to scripted tests
  • Clean up `update` in `Defaults`
  • Change "Updating" logging from info to debug
  • WIP: Improve sbt evaluation
  • [fport] ScalaTest nested suites reported in JUnit XML reports as "(It is not a test)"
  • Remove implicit formats from Defaults
  • Misc tweaks and cleanups
  • Add warning for slow hostname lookups on OS X
  • cleanKeepFiles is ignored if cleanFiles is overriden
  • Fix compile clean
  • fix sbt help new does not explain how to use sbt new
  • Monkeys
  • [WIP] Add Scala Outline view to vscode
  • Added name property to Command trait
  • Call the soon-to-exist Global#close when done compiling
  • Fix sbt/sbt#3143: Add test to confirm leak is gone
  • add visualize task to sbt
  • Implement sequential[B](tasks: Seq[Initialize[Task[B]]]) and remove useless coment outs
  • [WIP] Fix #3183: Add `inspect build` to detect unused
  • Merge branch 1.1.x into 1.x
  • Handle very long socket file paths on UNIX
  • Upgrade to sbt-buildinfo 0.8.0
  • add scalacOptions for scaladoc
  • Add the eviction warnings options to global
  • optimize scope delegation
  • add tests around scope delegation
  • Add an optional exitCode to ExecStatusEvent so clients can use it
  • Cleanup some parts of the LSP impl
  • WIP: Support non-echoing console for emacs
  • Optimize settings storage and delegation
  • make sbt server extensible
  • fix getDecoder
  • Clear singleton TaskProgress between runs
  • Use jline2 for raw mode
  • Miscellaneous ui/jline fixes
  • Remove lint warnings in sbt build
  • Make the BuildServerReporter stop blinking
  • Exit BspClient after server socket is closed
  • Fix NullPointerException in appendLog
  • update to lm-coursier-shaded 2.0.0-RC6-6
  • Introduce a Submission class for submitted works.
  • introduce a new new Input: FileInput
  • add nightly support
  • Use swoval source formatting plugin
  • Add SlashSyntax.unparse
  • Fix logger class loader leak with workaround
  • Properly log the ClassfileManager output
sbt questions on Stackoverflow (View All Questions)
  • Scala: change folder inside sbt
  • SBT asking for a command
  • Error trying to run SBT
  • Current procedure to change default port in Scalatra's scalatra-sbt giter8 template?
  • sbt cannot switch to project imported from github using ProjectRef
  • Cannot build SBT project with IntelliJ IDEA
  • sbt-assembly include test classes
  • Using SBT to drive a build Java+Scala build that includes SWIG and C++ compilation
  • Create standalone jar using SBT
  • Deploying sbt project in tomcat
  • How to check if application is being run via SBT?
  • SBT 0.13.8 multi module project with Playframework 2.4.2
  • scala compile in spark/sbt ERROR Access Denied in MS DOS
  • Tests fail when run with SBT on the command line but not when run in the IDE
  • SBT: Slow resolution and failures when doing builds within Docker containers
  • How to integrate sbt to existing scala eclipse project with TestSuit test Class?
  • Spark/sbt: Access denied, in windows 10 cmd
  • How generate play application with default SBT layout
  • How to set heap size for sbt?
  • sbt dist task fails with maximum delay error
  • How to trigger source generation with sbt
  • sbt docker:stage returns java.util.regex.PatternSyntaxException error
  • Building spark-jobserver Using SBT and Scala
  • Installing sbt-eclipse - unresolved dependency: com.typesafe.sbt
  • Is SBT incremental compilation reliable for java and scala?
  • No Java installation was detected while sbt update
  • IntelliJ with SBT plugin: Error Resolving [com.mycompany.mypackage]
  • sbt-proguard issue with Java 1.8
  • How to Compile Apache Spark with Scala 2.11.1 using SBT?
  • How can I publish obfuscated with ProGuard jar using sbt?
sbt list of languages used
sbt latest release notes
v1.3.13 1.3.13

Fixes

  • Updates to Giter8 0.13.1 to fix sbt new on Windows
  • Works around incomplete preloaded local distribution, by turning it off for now #5587
  • Fixes missingOk under Coursier #5634/sbt-coursier#212 by @eed3si9n
  • Fixes UNC paths handling in Resolver.file(...) lm#337 by @eed3si9n
  • Fixes sbt.bat not working under a directory with whitespace name lp#324 by @l-konov
  • Fixes -debug not working in SBT_OPTS lp#322 by @henricook
  • Fixes Robocopy output in sbt.bat lp#325 by @er1c
v1.4.0-M1 1.4.0-M1

Fixes with compatibility implications

  • Makes JAR file creation repeatable by sorting entry by name and dropping timestamps #5344/io#279 by @raboof
  • Loads bare settings in the alphabetic order of the build files #2697/#5447 by @eed3si9n
  • Loads vals from top-to-bottom within a build file #2232/#5448 by @eed3si9n
  • HTTP resolvers require explicit opt-in using .withAllowInsecureProtocol(true) #5593 by @eed3si9n

Build server protocol (BSP) support

sbt 1.4.0 adds build server protocol (BSP) support, contributed by Scala Center. Main implementation was done by Adrien Piquerez (@adpi2) based on @eed3si9n's prototype.

When sbt 1.4.0 starts, it will create a file named .bsp/sbt.json containing a machine-readable instruction on how to run sbt -bsp, which is a command line program that uses standard input and output to communicate to sbt server using build server protocol.

How to import to IntelliJ using BSP

  1. Start sbt in a terminal
  2. Open IntelliJ IDEA 2020.1.2 or later
  3. Select Open or import, and select BSP Project

How to import to VS Code + Metals

  1. Delete existing .bsp directory if any
  2. Open VS Code in the working directory
  3. Ignore the prompt to import the project
  4. Start sbt -Dsbt.semanticdb=true in the Terminal tab. Wait till it displays sbt server started
  5. Navigate to Metals view, and select Connect to build server
  6. Type compile into the sbt session to generate SemanticDB files

#5538/#5443 by @adpi2

VirtualFile + RemoteCache

sbt 1.4.0 / Zinc 1.4.0 virtualizes the file paths tracked during incremental compilation. The benefit for this that the state of incremental compilation can shared across different machines, as long as ThisBuild / rootPaths are enumerated beforehand.

To demonstrate this, we've also added experimental cached compilation feature to sbt. All you need is the following setting:

ThisBuild / pushRemoteCacheTo := Some(MavenCache("local-cache", file("/tmp/remote-cache")))

Then from machine 1, call pushRemoteCache. This will publish the *.class and Zinc Analysis artifacts to the location. Next, from machine 2, call pullRemoteCache.

zinc#712/#5417 by @eed3si9n

Build linting

On start up, sbt 1.4.0 checks for unused settings/tasks. Because most settings are on the intermediary to other settings/tasks, they are included into the linting by default. The notable exceptions are settings used exclusively by a command. To opt-out, you can either append it to Global / excludeLintKeys or set the rank to invisible.

#5153 by @eed3si9n

Conditional task

sbt 1.4.0 adds support for conditional task (or Selective task), which is a new kind of task automatically created when Def.task { ... } consists of an if-expression:

bar := {
  if (number.value < 0) negAction.value
  else if (number.value == 0) zeroAction.value
  else posAction.value
}

Unlike the regular (Applicative) task composition, conditional tasks delays the evaluation of then-clause and else-clause as naturally expected of an if-expression. This is already possible with Def.taskDyn { ... }, but unlike dynamic tasks, conditional task works with inspect command. See Selective functor for sbt for more details. #5558 by @eed3si9n

Other updates

Participation

sbt 1.4.0-M1 was brought to you by 25 contributors. Eugene Yokota (eed3si9n), Ethan Atkins, Adrien Piquerez, Dale Wijnand, Jason Zaugg, Arnout Engelen, Guillaume Martres, Anil Kumar Myla, Brice Jaglin, Steve Waldman, frosforever, Alex Zolotko, Heikki Vesalainen, Stephane Landelle, Jannik Thei, Joo Ferreira, lloydmeta, Alexandre Archambault, Erwan Queffelec, Ismael Juma, Kenji Yoshida (xuwei-k), Olafur Pall Geirsson, Renato Cavalcanti, Vincent PERICART, nigredo-tori. Thanks!

Thanks to everyone who's helped improve sbt and Zinc 1 by using them, reporting bugs, improving our documentation, porting builds, porting plugins, and submitting and reviewing pull requests.

For anyone interested in helping sbt, there are many avenues for you to help, depending on your interest. If you're interested, Contributing, help wanted, good first issue are good starting points.

Appendix

To test sbt server manually, make sure to have an sbt session running, and start sbt -bsp in another termnial. And paste the following in:

{ "jsonrpc": "2.0", "id": 1, "method": "build/initialize", "params": { "displayName": "foo", "version": "1.0.0", "bspVersion": "2.0.0-M5", "rootUri": "file:///tmp/hello", "capabilities": { "languageIds": ["scala"] } } }

Then enter \r\n (type Enter, Ctrl-J for zsh). This should return:

Content-Length: 200
Content-Type: application/vscode-jsonrpc; charset=utf-8

{"jsonrpc":"2.0","id":1,"result":{"displayName":"sbt","version":"1.4.0-SNAPSHOT","bspVersion":"2.0.0-M5","capabilities":{"compileProvider":{"languageIds":["scala"]},"dependencySourcesProvider":true}}}
v1.3.12 1.3.12

change since 1.3.11

There was a regression in sbt 1.3.11 around the handling of repositories file. sbt 1.3.12 fixes it. #5583

lm-coursier 2.0.0-RC6-4

sbt 1.3.11 updates lm-coursier to 2.0.0-RC6-4, which deprecates $HOME/.coursier/cache directory in favor of OS specific cache locations:

  • $HOME/Library/Caches/Coursier/v1 for macOS
  • %LOCALAPPDATA%\Coursier\Cache\v1 for Windows
  • $HOME/.cache/coursier/v1 for Linux etc

other fixes

Other projects in Scala
Powered by Autocode - Instant Webhooks, Scripts and APIs
Autocode logo wordmark