How to configure SBT to find a repository (working with resolvers)

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 18.11, “Telling SBT How to Find a Repository (Working with Resolvers).”


In a Scala SBT project, you want to add a managed dependency to your project from an Ivy repository that SBT doesn’t know about by default.


Use the resolvers key in the build.sbt file to add any unknown Ivy repositories. Use this syntax to add one resolver:

resolvers += " Maven2 Repository" at ""

You can use a Seq to add multiple resolvers:

resolvers ++= Seq(
    "Typesafe" at "",
    " Maven2 Repository" at ""

Or, if you prefer, you can also add them one line at a time, making sure to separate them by a blank line:

resolvers += "Typesafe" at ""

resolvers += " Maven2 Repository" at ""


If the module you’re requesting is in the default Maven2 repository SBT knows about (at, adding a managed dependency “just works.” But if the module isn’t there, the library’s author will need to provide you with the repository information.

You define a new repository in SBT’s build.sbt file with this general format:

resolvers += "repository name" at "location"

As shown in the Solution, you can enter one resolver at a time with the += method, and you can add multiple resolvers with ++= and a Seq.

In addition to the default Maven2 repository, SBT is also configured to know about the “JavaNet1Repository” at To use this repository in your SBT project, add this line to your build.sbt file:

resolvers += JavaNet1Repository

The Scala Cookbook

This tutorial is sponsored by the Scala Cookbook, which I wrote for O’Reilly:

You can find the Scala Cookbook at these locations:

Add new comment

The content of this field is kept private and will not be shown publicly.

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.