I have never been able to work offline with SBT on any of my projects. Now I\'m in the middle of a move and my wardrobe-server hosting nexus is offline.
So running s
There is a wiki page here: https://github.com/sbt/sbt/wiki/User-Stories:--Offline-mode-and-Dependency-Locking , edited in May, that says that SBT's notion of offline isn't working properly. This may be one reason why your build continues to try to resolve dependencies against remote repositories even when the offline
setting is set.
Starting from sbt 0.13.7, you can work offline when you use the dependency cache
To make it short:
updateOptions := updateOptions.value.withCachedResolution(true)
in your project settings (and in all subprojects settings)sbt clean compile
once online. It run like before, checking all resolution. But also create and store the resolved dependency graph locally (in ~/.sbt/0.13/dependency
).Then, if you don't change your dependencies, sbt will always use the cached dependency and won't need network (I just tried)
This seems like a terrible hack, but you can specify your ivy cache as an ivy repository, so that once your dependencies are downloaded, they can be resolved from the cache.
For example, your ~/.sbt/repositories could look like this:
[repositories]
local
maven-central
cache: file://${user.home}/.ivy2/cache, [organisation]/[module]/ivy-[revision].xml, [organisation]/[module]/[type]s/[module]-[revision].[type]
Note: I had to set the ivy and artifact patterns explicitly. Add the local cache below any other repos so they get tried first.
Me neither can use it in a one-liner.
But if I start sbt
and then in sbt I use set offline := true
it's working well.