2
votes

If I move a sbt project like freedom to a new machine, the new project will re-download the sbt dependency packages. It costs me lots of time and moreover the new project can't run if the machine don't connect to Internet. I have move the .ivy2/cache to the machine, but it still fails to run. Who can tell me how to solve it? Must it re-download packages while moving to new machine?

1
to run you usually make a big jar with all the dependencies. using something like github.com/sbt/sbt-assembly . - mfirry
What is the sbt version? From 1.3 they no longer use the Ivy cache (but the coursier cache now). But if you copy the cache directories over, it should not need to redownload what is already in there. - Thilo

1 Answers

1
votes

To expand on Thilo's comment:

SBT prior to 1.3 cached dependencies in ~/.ivy2/cache by default. As of 1.3, SBT uses Coursier for dependency resolution and caching which follows OS-specific caching standards described: https://get-coursier.io/docs/cache. You can set the cache yourself using the environment variable COURSIER_CACHE.