sbt, the interactive build tool
Go to file
Kevin Lee 0085a98614
[2.x] Make `clearCaches` clear the sbt 2 action cache as well
`clearCaches` only reset the in-memory session caches (compiler cache,
classloader cache, and file-cache stores) carried over from sbt 1, so none of
the action caches introduced in sbt 2 were actually cleared despite the help
text saying otherwise. The only way to remove the action cache was `cleanFull`,
which also wipes `target/out` entirely, including build outputs and the command
history.

`clearCaches` now additionally deletes, while respecting `cleanKeepFiles` and
`cleanKeepGlobs`:

- the contents of every local `DiskActionCacheStore` (the `cas/` and `ac/`
  directories under `localCacheDirectory`)
- the materialized task-value files under `target/out/value`
- symbolic links under `target/out` that point into a cleared store, which
  would otherwise be left dangling

Build outputs, the command history, and the boot directory are preserved.

Ordering and robustness details:

- The in-memory caches are reset before the on-disk stores are deleted, so
  files those caches may still hold open (e.g. jars referenced by cached
  classloaders) are released before their deletion is attempted. On Windows an
  open handle otherwise makes the underlying file undeletable.
- `target/out` references (symlinks) are deleted before the cas blobs they
  point at.
- Deletions retry on transient `IOException` (as `DiskActionCacheStore#syncFile`
  already does for writes) and, instead of being silently swallowed, any file
  that still cannot be deleted is reported: per-path at warn level, with the
  summary downgraded from "cleared" to "partially cleared".

The `clearCaches` help text is updated to describe the new behavior, and a
scripted test (`cache/clear-caches`) covers it. The test records a baseline of
existing store entries and asserts only that the entries it creates are cleared,
so unrelated blobs left behind by other tests sharing the batch sandbox are out
of scope.
2026-07-20 03:53:22 +10:00
.agents/skills/sbt-issue-fixing Add issue reproduction skill (#9400) 2026-06-29 14:18:35 +09:00
.devcontainer [2.x] Add devcontainer (#9392) 2026-06-27 15:21:49 -04:00
.github [2.x] fix: Fixes WinGet release config (#9404) 2026-06-30 21:27:56 -04:00
buildfile/src Support given in build.sbt 2026-07-06 20:07:30 +09:00
client Revert "[2.x] feat: Enable musl static linking for sbtn on JDK 17+ (#8464)" (#8557) 2026-01-16 00:06:28 -05:00
contributing-docs [2.x] Update to Scala 3.8.4 (#9302) 2026-06-07 20:52:13 -04:00
core-macros/src [2.x] Mark log-related keys transient (#9407) 2026-07-03 10:40:10 +02:00
internal [2.x] fix: Constrain job id parser to signed longs (#9353) 2026-06-27 00:15:43 -04:00
launch [2.x] restore JVM option capability in the launcher config (#9452) 2026-07-16 02:39:59 -04:00
launcher-package [2.x] Add native client startup diagnostics regression test (#9447) 2026-07-14 18:27:28 -04:00
licenses move remaining pieces of sbt subproject to sbt_pending and fix notices 2010-09-21 21:55:50 -04:00
lm-core [2.x] Deprecate Resolver.url 2026-07-10 11:46:26 -04:00
lm-coursier [2.x] fix: Fixes dependency tree rendering on some libraries (#9371) 2026-06-23 14:35:44 -04:00
lm-ivy/src [2.x] Deprecate Resolver.url 2026-07-10 11:46:26 -04:00
main [2.x] Make `clearCaches` clear the sbt 2 action cache as well 2026-07-20 03:53:22 +10:00
main-actions/src [2.x] Avoid dollars in name (#9313) 2026-06-08 23:39:10 -04:00
main-command/src [2.x] Make `clearCaches` clear the sbt 2 action cache as well 2026-07-20 03:53:22 +10:00
main-settings/src [2.x] Fix macro expand for HKT type arguments (#9377) 2026-06-24 21:22:11 -04:00
notes [2.x] fix: Don't cache environmental (position-less) compile failures (#9464) 2026-07-18 09:49:05 -04:00
project [2.x] fix: Don't cache environmental (position-less) compile failures (#9464) 2026-07-18 09:49:05 -04:00
protocol/src [2.x] refactor: Use java.util.Arrays.copyOf in JsonRpcReader (#9213) 2026-07-18 15:19:37 -04:00
run [2.x] ci: Scalafmt 3.11.1 (#9279) 2026-05-31 16:01:15 -04:00
sbt-app/src [2.x] Make `clearCaches` clear the sbt 2 action cache as well 2026-07-20 03:53:22 +10:00
sbt-ivy/src/main/scala/sbt [2.x] refactor: Use Files.writeString instead of Files.write (#9093) 2026-04-15 22:29:19 -04:00
sbt-remote-cache/src [2.x] fix: apply ByteStream deadline per-call, not on the memoized stub (#9413) 2026-07-08 23:30:08 +02:00
sbtw [2.x] ci: Scalafmt 3.11.1 (#9279) 2026-05-31 16:01:15 -04:00
scripted-sbt [2.x] ci: Scalafmt 3.11.1 (#9279) 2026-05-31 16:01:15 -04:00
scripts Fix lm-coursier scripted 2024-10-11 14:30:55 +02:00
server-test/src [2.x] Fix publishDiagnostics propagation (#9376) 2026-06-26 12:36:42 -04:00
src [2.x] Add scripted test for #7838 (#8541) 2026-01-20 12:13:27 -05:00
tasks [2.x] ci: Scalafmt 3.11.1 (#9279) 2026-05-31 16:01:15 -04:00
tasks-standard [2.x] ci: Scalafmt 3.11.1 (#9279) 2026-05-31 16:01:15 -04:00
testing Contraband 0.9.0 2026-06-01 01:52:50 -04:00
util-cache [2.x] fix: Don't cache environmental (position-less) compile failures (#9464) 2026-07-18 09:49:05 -04:00
util-collection [2.x] ci: Scalafmt 3.11.1 (#9279) 2026-05-31 16:01:15 -04:00
util-tracking [2.x] ci: Scalafmt 3.11.1 (#9279) 2026-05-31 16:01:15 -04:00
worker/src [2.x] fix: Include test arg into hash (#9222) 2026-05-16 04:12:33 -04:00
zinc-lm-integration/src [2.x] ci: Scalafmt 3.11.1 (#9279) 2026-05-31 16:01:15 -04:00
.git-blame-ignore-revs [2.x] blame ignore commits (#8814) 2026-02-25 10:51:21 -05:00
.gitattributes [2.x] Update .gitattributes for contraband files (#9076) 2026-04-12 13:51:06 -04:00
.gitignore [2.x] Add devcontainer (#9392) 2026-06-27 15:21:49 -04:00
.gitmodules Move metadata to lm-coursier/metadata 2024-10-09 09:44:42 +02:00
.java-version Scala 3.8.0 2026-01-24 04:52:28 -05:00
.jvmopts Add .jvmopts 2023-11-25 01:06:30 -05:00
.mailmap Add mailmap 2019-06-11 09:30:14 +02:00
.sbtopts Restore .sbtopts file 2020-11-19 12:42:26 -08:00
.scala-steward.conf Pin slf4j-api 2023-01-02 22:06:46 -05:00
.scalafix.conf [2.x] ci: Add scalafix DisableSyntax.noReturns (#8922) 2026-03-19 10:48:10 -04:00
.scalafmt.conf [2.x] ci: Scalafmt 3.11.1 (#9279) 2026-05-31 16:01:15 -04:00
AGENTS.md [2.x] fix: Fix spelling and link in AGENTS docs (#8837) 2026-03-01 00:25:09 -05:00
CONTRIBUTING.md [2.x] fix: Constrain job id parser to signed longs (#9353) 2026-06-27 00:15:43 -04:00
LICENSE Transfer copyright to Scala Center 2023-06-20 16:39:07 +02:00
NOTICE Transfer copyright to Scala Center 2023-06-20 16:39:07 +02:00
PROFILING.md docs: Update flamegraph guide --lines 2025-11-09 18:06:13 -05:00
README.md [2.x] docs: Move to CONTRIBUTING (#8629) 2026-01-25 15:48:09 -05:00
SUPPORT.md Transfer copyright to Scala Center 2023-06-20 16:39:07 +02:00
build.sbt [2.x] Bump version number (#9470) 2026-07-17 18:53:28 -04:00
sbt [2.x] sbtn 2.0.0-b4d628dd (#9443) 2026-07-12 21:07:14 -04:00
sbt-allsources.sh Merge remote-tracking branch 'lm/wip/sbt-2.x' into 2.x-lm-coursier 2024-10-09 08:50:03 +02:00
sbt.sh Implement sbt-launch.jar download 2021-04-19 23:43:15 -04:00
server.md setting query is "sbt/setting" 2017-10-03 01:45:06 -04:00

README.md

CI Latest version Discord

sbt

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

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

sbt 2.x

This is the 2.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/zinc hosts Zinc, an incremental compiler for Scala.
  • sbt/sbt, this repository hosts modules that implement the build tool.
  • 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 or a pull request.

If you're looking for an idea for a contribution, issues labeled with good first issue or help wanted might be good starting points.

If you would like to ask questions about sbt, there's sbt channel on Scala Discord, but it would be good to gather questions on Stackoverflow.

license

See LICENSE.