Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD

## org.gradle.api.artifacts.dsl
Interface RepositoryHandler

    org.gradle.api.artifacts.dsl.RepositoryHandler
      org.gradle.api.DomainObjectContainer
          org.gradle.api.artifacts.ResolverContainer
              org.gradle.api.DomainObjectCollection

All Superinterfaces:
  DomainObjectContainer, ResolverContainer, DomainObjectCollection

    interface RepositoryHandler
    extends ResolverContainer

author:
  Hans Dockter

Field Summary
`java.lang.String` | `DEFAULT_MAVEN_DEPLOYER_NAME`
`java.lang.String` | `DEFAULT_MAVEN_INSTALLER_NAME`

Method Summary
`FileSystemResolver` | `flatDir(Map args)` Adds a resolver that looks into a number of directories for artifacts.
`DependencyResolver` | `mavenCentral(Map args)` Adds a repository which looks in the Maven central repository for dependencies.
`DependencyResolver` | `mavenCentral()` Adds a repository which looks in the Maven central repository for dependencies.
`GroovyMavenDeployer` | `mavenDeployer()`
`GroovyMavenDeployer` | `mavenDeployer(Closure configureClosure)`
`GroovyMavenDeployer` | `mavenDeployer(Map args)` Adds a repository for publishing to a Maven repository.
`GroovyMavenDeployer` | `mavenDeployer(Map args, Closure configureClosure)` Behaves the same way as {
`MavenResolver` | `mavenInstaller()`
`MavenResolver` | `mavenInstaller(Closure configureClosure)`
`MavenResolver` | `mavenInstaller(Map args)` Adds a repository for installing to a local Maven cache.
`MavenResolver` | `mavenInstaller(Map args, Closure configureClosure)` Behaves the same way as {
`DependencyResolver` | `mavenRepo(Map args)` Adds a repository which is Maven compatible.

Methods inherited from interface ResolverContainer
add, add, addAfter, addAfter, addBefore, addBefore, addFirst, addFirst, getAt, getByName, getByName, getMavenPomDir, getMavenScopeMappings, getResolvers, setMavenPomDir

Methods inherited from interface DomainObjectContainer
addRule, getRules

Methods inherited from interface DomainObjectCollection
allObjects, allObjects, findAll, findByName, getAll, getAsMap, getAt, getByName, getByName, matching, whenObjectAdded, whenObjectAdded, whenObjectRemoved, withType

Methods inherited from interface java.lang.Iterable
iterator

Methods inherited from class java.lang.Object
wait, wait, wait, hashCode, getClass, equals, toString, notify, notifyAll

Field Detail

### DEFAULT_MAVEN_DEPLOYER_NAME

    final java.lang.String DEFAULT_MAVEN_DEPLOYER_NAME

### DEFAULT_MAVEN_INSTALLER_NAME

    final java.lang.String DEFAULT_MAVEN_INSTALLER_NAME

Method Detail

### flatDir

    public FileSystemResolver flatDir(Map args)

  Adds a resolver that looks into a number of directories for artifacts. The artifacts are expected to be located in the root of the specified directories. The resolver ignores any group/organization information specified in the dependency section of your build script. If you only use this kind of resolver you might specify your dependencies like `":junit:4.4"` instead of `"junit:junit:4.4"`. The following parameter are accepted as keys for the map:

  Key | Description of Associated Value
  --- | ---
  `name` | (optional) The name of the repository. The default is a Hash value of the rootdir paths. The name is used in the console output, to point to information related to a particular repository. A name must be unique amongst a repository group.
  `dirs` | Specifies a list of rootDirs where to look for dependencies.

  Examples:

       repositories {
           flatDir name: 'libs', dirs: "$projectDir/libs"
           flatDir dirs: ["$projectDir/libs1", "$projectDir/libs2"]
       }

  param:
    args
  return:
    the added resolver
  throws:
    org.gradle.api.InvalidUserDataException In the case neither rootDir nor rootDirs is specified of if both are specified.

### mavenCentral

    public DependencyResolver mavenCentral(Map args)

  Adds a repository which looks in the Maven central repository for dependencies. The URL used to access this repository is always #MAVEN_CENTRAL_URL. The behavior of this resolver is otherwise the same as the ones added by #mavenRepo(java.util.Map). The following parameter are accepted as keys for the map:

  Key | Description of Associated Value
  --- | ---
  `name` | (optional) The name of the repository. The default is #DEFAULT_MAVEN_CENTRAL_REPO_NAME is used as the name. A name must be unique amongst a repository group.
  `urls` | A single jar repository or a collection of jar repositories. Sometimes the artifact lives in a different repository than the pom. In such a case you can specify further locations to look for an artifact. But be aware that the pom is only looked up in the root repository

  Examples:

       repositories {
           mavenCentral urls: ["http://www.mycompany.com/repository1", "http://www.mycompany.com/repository2"]
           mavenCentral name: "nonDefaultName", urls: ["http://www.mycompany.com/repository"]
       }

  param:
    args A list of urls of repositories to look for artifacts only.
  return:
    the added resolver
  see:
    #mavenRepo(java.util.Map)

### mavenCentral

    public DependencyResolver mavenCentral()

  Adds a repository which looks in the Maven central repository for dependencies. The URL used to access this repository is #MAVEN_CENTRAL_URL. The name of the repository is #DEFAULT_MAVEN_CENTRAL_REPO_NAME.

  Examples:

       repositories {
           mavenCentral()
       }

  return:
    the added resolver
  see:
    #mavenRepo(java.util.Map)
  see:
    #mavenCentral(java.util.Map)

### mavenDeployer

    public GroovyMavenDeployer mavenDeployer()

### mavenDeployer

    public GroovyMavenDeployer mavenDeployer(Closure configureClosure)

### mavenDeployer

    public GroovyMavenDeployer mavenDeployer(Map args)

  Adds a repository for publishing to a Maven repository. This repository can not be used for reading from a Maven repository. The following parameter are accepted as keys for the map:

  Key | Description of Associated Value
  --- | ---
  `name` | (optional) The name of the repository. The default is mavenDeployer-{SOME_ID}. The name is used in the console output, to point to information related to a particular repository. A name must be unique amongst a repository group.

  param:
    args The argument to create the repository
  return:
    The added repository
  see:
    #mavenDeployer(java.util.Map, groovy.lang.Closure)

### mavenDeployer

    public GroovyMavenDeployer mavenDeployer(Map args, Closure configureClosure)

  Behaves the same way as #mavenDeployer(java.util.Map). Additionally a closure can be passed to further configure the added repository.
  param:
    args The argument to create the repository
  param:
    configureClosure
  return:
    The added repository

### mavenInstaller

    public MavenResolver mavenInstaller()

### mavenInstaller

    public MavenResolver mavenInstaller(Closure configureClosure)

### mavenInstaller

    public MavenResolver mavenInstaller(Map args)

  Adds a repository for installing to a local Maven cache. This repository can not be used for reading. The following parameter are accepted as keys for the map:

  Key | Description of Associated Value
  --- | ---
  `name` | (optional) The name of the repository. The default is mavenInstaller-{SOME_ID}. The name is used in the console output, to point to information related to a particular repository. A name must be unique amongst a repository group.

  param:
    args The argument to create the repository
  return:
    The added repository
  see:
    #mavenInstaller(java.util.Map, groovy.lang.Closure) (java.util.Map, groovy.lang.Closure)

### mavenInstaller

    public MavenResolver mavenInstaller(Map args, Closure configureClosure)

  Behaves the same way as #mavenInstaller(java.util.Map). Additionally a closure can be passed to further configure the added repository.
  param:
    args The argument to create the repository
  param:
    configureClosure
  return:
    The added repository

### mavenRepo

    public DependencyResolver mavenRepo(Map args)

  Adds a repository which is Maven compatible. The compatibility is in regard to layout, snapshothandling and dealing with the pom.xml. This repository can't be used for publishing in a Maven compatible way. For publishing to a Maven repository, have a look at #mavenDeployer(java.util.Map) or #mavenInstaller(java.util.Map). By default the repository accepts to resolve artifacts without a pom. The repository always looks first for the pom in the root repository. It then looks for the artifact in the root repository. Sometimes the artifact lives in a different repository than the pom. In such a case you can specify further locations to look for an artifact. But be aware that the pom is only looked up in the root repository. The following parameter are accepted as keys for the map:

  Key | Description of Associated Value
  --- | ---
  `name` | (optional) The name of the repository. The default is the URL of the root repo. The name is used in the console output, to point to information related to a particular repository. A name must be unique amongst a repository group.
  `urls` | A single repository url or a list of urls. The first url is the the url of the root repo. Gradle always looks first for the pom in the root repository. After this it looks for the artifact in the root repository. If the artifact can't be found there, it looks for it in the other repositories.

  Examples:

       repositories {
           mavenRepo urls: ["http://www.mycompany.com/repository1", "http://www.mycompany.com/repository2"]
           mavenRepo name: "nonDefaultName", urls: ["http://www.mycompany.com/repository"]
       }

  For Ivy related reasons, Maven Snapshot dependencies are only properly resolved if no additional jar locations are specified. This is unfortunate and we hope to improve this in a future release.
  param:
    args The argument to create the repository
  return:
    the added repository
  see:
    #mavenCentral(java.util.Map)

Groovy Documentation