John
John

Reputation: 1611

How to clear sbt cache?

I'm using sbt 1.3.9 and I need to update some libraries that have changed its code but the version stays the same. When I tried to run sbt update command nothing happened the library not downloaded. I have sbt.build file that looks like the following:

name := """project name"""
organization := "com.example"

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayJava)
lazy val usr = sys.env("MVN_USER")

scalaVersion := "2.13.1"
javacOptions ++= Seq("-source", "11", "-target", "11")
resolvers ++= Seq(
  "Jfrog Artifacts".at("https://artifactory.jfrog.com/")
)
credentials += Credentials(
  ...
)
updateOptions := updateOptions.value.withCachedResolution(false)
updateOptions := updateOptions.value.withLatestSnapshots(false)
libraryDependencies ++= Seq(
  guice,
  javaWs,
  ehcache,
  "com.google.api-client" % "google-api-client" % "1.30.7",
  "org.apache.commons" % "commons-lang3" % "3.9",
  "redis.clients" % "jedis" % "3.2.0"
)

how can I clear sbt cache?

Upvotes: 9

Views: 20710

Answers (4)

Andy Ai
Andy Ai

Reputation: 93

You can use PrettyClean to clean the all of dev tools caches including SBT.

PrettyClean also cleans the SBT project's target folder.

Upvotes: -3

mike
mike

Reputation: 2196

You can just delete the v1 folder.

The default cache location is platform-dependent:

  • on Linux, ~/.cache/coursier/v1. This also applies to Linux-based CI environments, and FreeBSD too.
  • on OS X, ~/Library/Caches/Coursier/v1.
  • on Windows, %LOCALAPPDATA%\Coursier\Cache\v1, which, for user Alex, typically corresponds to C:\Users\Alex\AppData\Local\Coursier\Cache\v1.

Upvotes: 20

ApprenticeWST
ApprenticeWST

Reputation: 127

I had experienced this while using IntelliJ. After closing IntelliJ, I used to clear .idea from project folder and reimport project into IntelliJ was helping me.

Upvotes: 0

Mateusz Kubuszok
Mateusz Kubuszok

Reputation: 27595

I assuming that you are developing something locally and doing publishLocal - normal repository wouldn't let you override published dependency and snapshots are not cached (sbt checks if newer appeared every time you need to build sth).

In such case start using snapshot versions for the future and/or go to ~/.ivy2/your.organisation/library_scalaVersion and remove whole directory with "bad" version. If library is fetched by Maven (with sbt, unlikely these days) it the same idea but with ~/.m2.

Upvotes: 1

Related Questions