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

## org.gradle.api.artifacts.dsl
[Java] Interface RepositoryHandler

    org.gradle.api.NamedDomainObjectList
      org.gradle.api.artifacts.ArtifactRepositoryContainer
          java.lang.Iterable
              org.gradle.api.DomainObjectCollection
                  org.gradle.api.NamedDomainObjectCollection
                      java.util.Collection
                          org.gradle.api.artifacts.dsl.RepositoryHandler

All Superinterfaces:
  NamedDomainObjectList, ArtifactRepositoryContainer, DomainObjectCollection, NamedDomainObjectCollection

    public interface RepositoryHandler
    extends ArtifactRepositoryContainer

A `RepositoryHandler` manages a set of repositories, allowing repositories to be defined and queried.

Authors:
  Hans Dockter

Field Summary

Fields inherited from interface ArtifactRepositoryContainer
DEFAULT_CACHE_ARTIFACT_PATTERN, DEFAULT_CACHE_IVY_PATTERN, DEFAULT_MAVEN_CENTRAL_REPO_NAME, DEFAULT_MAVEN_LOCAL_REPO_NAME, INTERNAL_REPOSITORY_NAME, MAVEN_CENTRAL_URL, MAVEN_REPO_PATTERN, RESOLVER_NAME, RESOLVER_URL

Method Summary
`FlatDirectoryArtifactRepository` | `flatDir(java.util.Map args)` Adds a resolver that looks into a number of directories for artifacts.
`FlatDirectoryArtifactRepository` | `flatDir(groovy.lang.Closure configureClosure)` Adds an configures a repository which will look for dependencies in a number of local directories.
`FlatDirectoryArtifactRepository` | `flatDir(Action action)` Adds an configures a repository which will look for dependencies in a number of local directories.
`IvyArtifactRepository` | `ivy(groovy.lang.Closure closure)` Adds and configures an Ivy repository.
`IvyArtifactRepository` | `ivy(Action action)` Adds and configures an Ivy repository.
`MavenArtifactRepository` | `maven(groovy.lang.Closure closure)` Adds and configures a Maven repository.
`MavenArtifactRepository` | `maven(Action action)` Adds and configures a Maven repository.
`MavenArtifactRepository` | `mavenCentral(java.util.Map args)` Adds a repository which looks in the Maven central repository for dependencies.
`MavenArtifactRepository` | `mavenCentral()` Adds a repository which looks in the Maven central repository for dependencies.
`MavenArtifactRepository` | `mavenLocal()` Adds a repository which looks in the local Maven cache for dependencies.
`org.apache.ivy.plugins.resolver.DependencyResolver` | `mavenRepo(java.util.Map args)` Adds a repository which is Maven compatible.
`org.apache.ivy.plugins.resolver.DependencyResolver` | `mavenRepo(java.util.Map args, groovy.lang.Closure configClosure)` Adds a repository which is Maven compatible.

Methods inherited from interface ArtifactRepositoryContainer
add, add, add, addAfter, addAfter, addBefore, addBefore, addFirst, addFirst, addFirst, addLast, addLast, addLast, getAt, getByName, getByName, getResolvers

Methods inherited from interface NamedDomainObjectList
findAll, matching, matching, withType

Methods inherited from interface org.gradle.util.Configurable
org.gradle.util.Configurable#configure(groovy.lang.Closure)

Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Method Detail

### flatDir

    public FlatDirectoryArtifactRepository flatDir(java.util.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. These are evaluated as for Project.files

  Examples:

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

  throws:
    org.gradle.api.InvalidUserDataException In the case neither rootDir nor rootDirs is specified of if both are specified.
  Parameters:
    `args` - The arguments used to configure the repository.
  Returns:
    the added resolver

### flatDir

    public FlatDirectoryArtifactRepository flatDir(groovy.lang.Closure configureClosure)

  Adds an configures a repository which will look for dependencies in a number of local directories.
  Parameters:
    `configureClosure` - The closure to execute to configure the repository.
  Returns:
    The repository.

### flatDir

    public FlatDirectoryArtifactRepository flatDir(Action action)

  Adds an configures a repository which will look for dependencies in a number of local directories.
  Parameters:
    `action` - The action to execute to configure the repository.
  Returns:
    The repository.

### ivy

    public IvyArtifactRepository ivy(groovy.lang.Closure closure)

  Adds and configures an Ivy repository.
  Parameters:
    `closure` - The closure to use to configure the repository.
  Returns:
    The added repository.

### ivy

    public IvyArtifactRepository ivy(Action action)

  Adds and configures an Ivy repository.
  Parameters:
    `action` - The action to use to configure the repository.
  Returns:
    The added repository.

### maven

    public MavenArtifactRepository maven(groovy.lang.Closure closure)

  Adds and configures a Maven repository.
  Parameters:
    `closure` - The closure to use to configure the repository.
  Returns:
    The added repository.

### maven

    public MavenArtifactRepository maven(Action action)

  Adds and configures a Maven repository.
  Parameters:
    `action` - The action to use to configure the repository.
  Returns:
    The added repository.

### mavenCentral

    public MavenArtifactRepository mavenCentral(java.util.Map args)

  Adds a repository which looks in the Maven central repository for dependencies. The URL used to access this repository is always ArtifactRepositoryContainer.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 { value: org.gradle.api.artifacts.ArtifactRepositoryContainer#DEFAULT_MAVEN_CENTRAL_REPO_NAME} is used as the name. A name must be unique amongst a repository group.
  `artifactUrls` | A single jar repository or a collection of jar repositories containing additional artifacts not found in the maven central repository. But be aware that the POM must exist in maven central. The provided values are evaluated as for Project.uri.

  Examples:

       repositories {
           mavenCentral artifactUrls: ["http://www.mycompany.com/artifacts1", "http://www.mycompany.com/artifacts2"]
           mavenCentral name: "nonDefaultName", artifactUrls: ["http://www.mycompany.com/artifacts1"]
       }

Parameters:
  `args` - A list of urls of repositories to look for artifacts only.

Returns:
  the added repository

### mavenCentral

    public MavenArtifactRepository mavenCentral()

  Adds a repository which looks in the Maven central repository for dependencies. The URL used to access this repository is {
  value:
    org.gradle.api.artifacts.ArtifactRepositoryContainer#MAVEN_CENTRAL_URL}. The name of the repository is {@value org.gradle.api.artifacts.ArtifactRepositoryContainer#DEFAULT_MAVEN_CENTRAL_REPO_NAME}.

    Examples:

         repositories {
             mavenCentral()
         }

  Returns:
    the added resolver
  See Also:
    mavenCentral(java.util.Map)

### mavenLocal

    public MavenArtifactRepository mavenLocal()

  Adds a repository which looks in the local Maven cache for dependencies. The name of the repository is {
  value:
    org.gradle.api.artifacts.ArtifactRepositoryContainer#DEFAULT_MAVEN_LOCAL_REPO_NAME}.

    Examples:

         repositories {
             mavenLocal()
         }

  Returns:
    the added resolver

### mavenRepo

    public org.apache.ivy.plugins.resolver.DependencyResolver mavenRepo(java.util.Map args)

  Adds a repository which is Maven compatible. The compatibility is in regard to layout, snapshot handling 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 MavenRepositoryHandlerConvention.mavenDeployer or MavenRepositoryHandlerConvention.mavenInstaller. 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.
  `url` | The root repository where POM files and artifacts are located. The provided values are evaluated as for Project.uri.
  `artifactUrls` | A single jar repository or a collection of jar repositories containing additional artifacts not found 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 provided values are evaluated as for Project.uri.

  Examples:

       repositories {
           mavenRepo url: "http://www.mycompany.com/repository", artifactUrls: ["http://www.mycompany.com/artifacts1", "http://www.mycompany.com/artifacts2"]
           mavenRepo name: "nonDefaultName", url: "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.
  Parameters:
    `args` - The argument to create the repository
  Returns:
    the added repository

### mavenRepo

    public org.apache.ivy.plugins.resolver.DependencyResolver mavenRepo(java.util.Map args, groovy.lang.Closure configClosure)

  Adds a repository which is Maven compatible.

Groovy Documentation