Maven-style repositories are defined like:

  val scalaToolsSnapshots = "Scala-Tools Maven2 Snapshots Repository" at ""

and use the Maven2 layout. This page describes how to define other types of repositories.


A few predefined repositories are available and are listed below

  • DefaultMavenRepository
This is the main Maven repository at and is included by default
  • ScalaToolsReleases
This is the releases repository at and is included by default
  • ScalaToolsSnapshots
This is the snapshots repository at
  • JavaNet1Repository
This is the Maven 1 repository at

For example, to use the repository, add the following line to your project definition:

  val javaNet = JavaNet1Repository


sbt provides an interface to the repository types available in Ivy: file, URL, SSH, and SFTP. A key feature of repositories in Ivy is using patterns to configure repositories.

Construct a repository definition using the factory in sbt.Resolver for the desired type. This factory creates a Repository object that can be further configured. The following table contains links to the Ivy documentation for the repository type and the API documentation for the factory and repository class. The SSH and SFTP repositories are configured identically except for the name of the factory. Use Resolver.ssh for SSH and Resolver.sftp for SFTP.

Type Factory Ivy Docs Factory API Repository Class API
Filesystem Resolver.file Ivy Factory FileRepository API
SFTP Resolver.sftp Ivy Factory SftpRepository API
SSH Resolver.ssh Ivy Factory SshRepository API
URL Resolver.url Ivy Factory URLRepository API

Basic Examples

These are basic examples that use the default Maven-style repository layout.


Define a filesystem repository in the test directory of the current working directory and declare that publishing to this repository must be atomic.

  val testRepo = Resolver.file("my-test-repo", new"test")) transactional()


Define a URL repository at ."".

  def url = new"")
  val testRepo = Resolver.url("my-test-repo", url)

To specify an Ivy repository, use:

  val testRepo = Resolver.url("my-test-repo", url)(Resolver.ivyStylePatterns)

or customize the layout pattern describe in the Custom Layout section below.

SFTP and SSH Repositories

The following defines a repository that is served by SFTP from host "":

  val sftpRepo = Resolver.sftp("my-sftp-repo", "")

To explicitly specify the port:

  val sftpRepo = Resolver.sftp("my-sftp-repo", "", 22)

To specify a base path:

  val sftpRepo = Resolver.sftp("my-sftp-repo", "", "maven2/repo-releases/")

Authentication for the repositories returned by sftp and ssh can be configured by the as methods.

To use password authentication:

  val sshRepo = Resolver.ssh("my-ssh-repo", "") as("user", "password")

or to be prompted for the password:

  val sshRepo = Resolver.ssh("my-ssh-repo", "") as("user")

To use key authentication:

  val keyFile: File = ...
  val sshRepo = Resolver.ssh("my-ssh-repo", "") as("user", keyFile, "keyFilePassword")

or if no keyfile password is required or if you want to be prompted for it:

  val sshRepo = Resolver.ssh("my-ssh-repo", "") as("user", keyFile)

To specify the permissions used when publishing to the server:

  val sshRepo = Resolver.ssh("my-ssh-repo", "") withPermissions("0644")

This is a chmod-like mode specification.

Custom Layout

These examples specify custom repository layouts using patterns. The factory methods accept an implicit Patterns instance that defines the patterns to use. The patterns are first resolved against the base file or URL. The implicit normally supplied gives the default Maven-style layout. Provide a different Patterns object to use a different layout. For example:

  val testRepo = Resolver.url("my-test-repo", url)( Patterns("[organisation]/[module]/[revision]/[artifact].[ext]") )

You can specify multiple patterns or patterns for the metadata and artifacts separately. You can also specify whether the repository should be Maven compatible (as defined by Ivy). See the patterns API documentation for the methods to use.

For filesystem and URL repositories, you can specify absolute patterns by omitting the base URL, passing an empty Patterns instance, and using ivys and artifacts:

  val testRepo = Resolver.url("my-test-repo") artifacts