Reputation: 1739
I need to use sbt in an offline environment, but I can stage all of the necessary jars on the filesystem as a local repository. How do I define ~/.sbt/repositories so that it will check the local filesystem for the jars that sbt (and my project) needs? For bonus points, what's the easiest way to set up the local file based repository?
Upvotes: 4
Views: 1065
Reputation: 973
It is all explained at http://www.scala-sbt.org/release/docs/Detailed-Topics/Proxy-Repositories.html
In a nutshell you have to put this into ~/.sbt/repositories
[repositories]
local
sharedRepo: file:///path/to/my/shared/repo/.m2/repository
and invoke sbt (or play/activator) with -Dsbt.override.build.repos=true
This will make sure that only local and shared repository is used for resolving dependencies.
The easiest way to make sure that local repository contains the jars you need is to delete the ~/.sbt/repositories file and do an sbt update
on the project while online (without the -Dsbt.override.build.repos=true parameter). After that restore the ~/.sbt/repositories file and all resolving will be done from your local repository only.
For setting up a private repository look at artifactory, it has an open source version that is enough for a maven repository.
http://www.jfrog.com/home/v_artifactory_opensource_overview
Upvotes: 4