scalasbt

Does `sbt compile` install things out of the current project directory?


I am a noob in scala. I installed it using coursier and am using sbt to try and write code in it. Basically, I use the two commands sbt compile and sbt run for my code. Along, with that I was experimenting with build.sbt. It seems that I've downloaded too many scala versions while running sbt compile again and again.

I have few questions regarding sbt compile

sbt clean only affects the target directory.


Solution

  • Yes, sbt stores (install is kind of a heavy word here) everything it downloads in a cache directory, so that if multiple projects depend on the same tools then you don't need to re-download and re-store them.

    The specific folder depends on your OS, but it usually is in your home under .coursier/cache or something similar: https://get-coursier.io/docs/cache#default-location

    However, unless you are dealing with a weird bug or just want to free disk space, just doing sbt clean will ensure your project is in a clean state.