I want to use SBT with IntelliJ IDEA 14.1. However, I want to download everything from our company-internal Nexus server. I made two repository groups there which contain some proxy repositories.
My .sbt/repositories
file looks like this:
[repositories]
local
my-ivy-proxy-releases: http://our-nexus/nexus/content/groups/sbt_ivy_group/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
my-maven-proxy-releases: http://our-nexus/nexus/content/groups/public/
The URLs are fine, I can open them in my browser.
Now, when I run sbt
either from command line or from IntelliJ IDEA, it tries to download from repo.scala-sbt.org, repo.typesafe.com etc. even though I do not want it.
How do I force SBT to only download from the repositories in the repositories file?
EDIT: It does download from our company nexus, but only after trying the "official" releases, which result in loads of "connection refused" because we are behind an HTTP proxy which slows dependency resolving down quite a lot.
EDIT 2: I tried to add -Dsbt.override.build.repos=true
to the VM parameters of IDEA's SBT settings, but this does not seem to change anything.
The best way is to override default repositories: from help in sbt and also here
Override default resolvers
resolvers
configures additional, inline user resolvers. By default, sbt combines these resolvers with default repositories (Maven Central and the local Ivy repository) to formexternalResolvers
. To have more control over repositories, setexternalResolvers
directly. To only specify repositories in addition to the usual defaults, configureresolvers
.For example, to use the Sonatype OSS Snapshots repository in addition to the default repositories,
To use the local repository, but not the Maven Central repository:
Override all resolvers for all builds
The repositories used to retrieve sbt, Scala, plugins, and application dependencies can be configured globally and declared to override the resolvers configured in a build or plugin definition. There are two parts:
The repositories used by the launcher can be overridden by defining ~/.sbt/repositories, which must contain a
[repositories]
section with the same format as the Launcher Specification configuration file. For example:A different location for the repositories file may be specified by the
sbt.repository.config
system property in the sbt startup script. The final step is to setsbt.override.build.repos
to true to use these repositories for dependency resolution and retrieval.