sbt 2.0.4
The headline features of sbt 2.0.4 are:
- Forked runs in current directory
- Caching-related bug fixes
- Memory improvement on large builds
See also sbt 2.0 change summary for the details.
Hi everyone. On behalf of the sbt project, I am happy to announce sbt 2.0.4. sbt 2.0 is a new major series of sbt, based on Scala 3 constructs and Bazel-compatible cache system. sbt 2.x is released under Semantic Versioning, and the plugins are expected to work throughout the 2.x series. Please try it out, and report any issues you might come across.
How to upgrade
The sbt version used for your build is upgraded by putting the following in project/build.properties:
sbt.version=2.0.4
This mechanism allows that sbt 2.0.4 is used only for the builds that you want.
Download the official sbt runner from SDKMAN, or download from https://github.com/sbt/sbt/releases/tag/v2.0.4 to upgrade the sbt shell script, sbtn, and the launcher.
Changes with compatibility implications
Forked run working directory
Starting sbt 2.0.4, the working directory for forked run will be changed to the build’s working directory instead of the subproject’s baseDirectory.
scalaVersion := "3.8.4"
lazy val app = project
This is intended to make client-side run behave similar to sbt 1’s run task. For example, app/run will run inside . as opposed to app. This was contributed by @jozanek in #9442.
🐛 Bug fixes
- fix: Fixes test ClassLoader retention issues by @kevin-lee in #9485
- fix: Fixes common settings with a plugin with
extraProjectsby @eed3si9n in #9495 - fix: Fixes dependency tree rendering on some libraries by @anatoliykmetyuk in #9371
- fix: Fixes tests not detecting stale resources by @eed3si9n in #9469
- fix: Fixes sbtn not propagating
-java-homeby @BrianHotopp in #9448 - fix: Fixes
cleantask not cleaning sona-staging by @eed3si9n in #9479 - fix: Fixes reboot from sbtn by @BrianHotopp in #9497
🐛 Caching related bug fixes
- fix: Fixes hashes for directories in MappedVirtualFile by @raboof in zinc#1747
- fix: Fixes
Def.declareOutputinvoked in a loop by @BrianHotopp in #9492 - fix: Fixes partial cache restoration by @stasimus in #9488
- fix: Fixes system errors getting cached as compilation errors by @BrianHotopp in #9464
- fix: Improves cache restoration when the expected outputs are missing by @BrianHotopp in #9473
- fix: Fixes gRPC channels recreated on reload by @eed3si9n in #9502
- fix: Fixes scalaCompilerBridgeBin task leaking project name by @eed3si9n in #9506
- refactor: Separate file I/O from cache-write serialization by @BrianHotopp in #9496
🚀 Updates
- feat: Skip checksum generation for
*.ascfile during publishing by @eed3si9n in #9499 - feat: Move compiler bridge to
updateby @eed3si9n in #8836 - feat: Allow opt-out of transient warning by @eed3si9n in #9437
- perf: Intern directory item conversions in MappedFileConverter by @hoangmaihuy in #1751
- perf: Intern analysis values while deserializing by @hoangmaihuy in #1754
Participation
sbt 2.0.4 is brought to you by 8 contributors. Eugene Yokota (eed3si9n), Brian Hotopp, Mai Huy Hoàng, Anatolii Kmetiuk, Arnout Engelen, Jozef Koval, Kevin Lee, Stas Shevchenko. Thanks!
Thanks to everyone who’s helped improve sbt and Zinc 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”, and Discussions are good starting points.
FYI - Scala Days talk
I gave a talk in Scala Days 2025 about sbt 2.0 (recording, slide deck).
Donate to Scala Center
Scala Center is a non-profit center at EPFL to support education and open source.