I have recently installed SBT on Windows XP SP3 machine to get started with Scala. When I started it initially, it started grabbing all the JAR's from the remote locations - pretty much like Maven or any other dependency management tool.
But, whenever I change my directory and fire up sbt
, it again starts downloading the entire solution. Is there a way of maintaining a global cache whereby artifacts are only downloaded once and not every time I change my working directory?
If you have JAR files (unmanaged dependencies) that you want to use in your project, simply copy them to the lib folder in the root directory of your SBT project, and SBT will find them automatically.
By default, sbt uses the standard Ivy home directory location ${user. home}/. ivy2/ . This can be configured machine-wide, for use by both the sbt launcher and by projects, by setting the system property sbt.
Library dependencies can be added in two ways: unmanaged dependencies are jars dropped into the lib directory. managed dependencies are configured in the build definition and downloaded automatically from repositories.
sbt 1.3. x ships with coursier support out-of-the-box, and that support is enabled by default. You shouldn't need to add sbt-coursier to sbt 1.3. x builds in most cases.
If you run the same version of sbt in a new directory, it will first look in the local ivy2 cache. It will still check all the resources, but will get them locally if they already exist.
However, if you are using SBT extras, it may re-download if you change to a different version of SBT, because it creates a cache for each version. That's my experience on Ubuntu in any case.
What you may have experienced is that some types of sbt plugins, for example sbt-idea, may download additional resources such as source repositories and documentation.
In my case (Debian), every time I run sbt
it gets files from Getting org.scala-sbt sbt 0.13.16
. I was not having a local ivy2
catch. The solution was just to copy the .ivy2
folder in /root
to your user home /home/username
and give access permissions to user.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With