RepositoryHandler

API Documentation:RepositoryHandler

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

Properties

No properties

Methods

MethodDescription
flatDir(configureClosure)

Adds an configures a repository which will look for dependencies in a number of local directories.

flatDir(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:

flatDir(action)

Adds an configures a repository which will look for dependencies in a number of local directories.

google()

Adds a repository which looks in Google's Maven repository for dependencies.

google(action)

Adds a repository which looks in Google's Maven repository for dependencies.

gradlePluginPortal()
Incubating

Adds a repository which looks in Gradle Central Plugin Repository for dependencies.

gradlePluginPortal(action)
Incubating

Adds a repository which looks in Gradle Central Plugin Repository for dependencies.

ivy(closure)

Adds and configures an Ivy repository. Newly created instance of IvyArtifactRepository is passed as an argument to the closure.

ivy(action)

Adds and configures an Ivy repository.

jcenter()

Adds a repository which looks in Bintray's JCenter repository for dependencies.

jcenter(action)

Adds a repository which looks in Bintray's JCenter repository for dependencies.

maven(closure)

Adds and configures a Maven repository. Newly created instance of MavenArtifactRepository is passed as an argument to the closure.

maven(action)

Adds and configures a Maven repository.

mavenCentral()

Adds a repository which looks in the Maven central repository for dependencies. The URL used to access this repository is https://repo.maven.apache.org/maven2/. The name of the repository is MavenRepo.

mavenCentral(args)

Adds a repository which looks in the Maven central repository for dependencies. The URL used to access this repository is https://repo.maven.apache.org/maven2/.

mavenCentral(action)

Adds a repository which looks in the Maven central repository for dependencies. The URL used to access this repository is https://repo.maven.apache.org/maven2/. The name of the repository is MavenRepo.

mavenLocal()

Adds a repository which looks in the local Maven cache for dependencies. The name of the repository is MavenLocal.

mavenLocal(action)

Adds a repository which looks in the local Maven cache for dependencies. The name of the repository is MavenLocal.

Methods added by the maven plugin

MethodDescription
mavenDeployer()

Adds a repository for publishing to a Maven repository. This repository can not be used for resolving dependencies.

mavenDeployer(configureClosure)

Adds a repository for publishing to a Maven repository. This repository can not be used for resolving dependencies.

mavenDeployer(args)

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

mavenDeployer(args, configureClosure)

Adds a repository for publishing to a Maven repository. This repository can not be used for resolving dependencies.

mavenDeployer(args, configureAction)

Adds a repository for publishing to a Maven repository. This repository can not be used for resolving dependencies.

mavenDeployer(configureAction)

Adds a repository for publishing to a Maven repository. This repository can not be used for resolving dependencies.

mavenInstaller()

Adds a repository for installing to a local Maven cache. This repository can not be used for resolving dependencies.

mavenInstaller(configureClosure)

Adds a repository for installing to a local Maven cache. This repository can not be used for resolving dependencies.

mavenInstaller(args)

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

mavenInstaller(args, configureClosure)

Adds a repository for installing to a local Maven cache. This repository can not be used for resolving dependencies.

mavenInstaller(args, configureAction)

Adds a repository for installing to a local Maven cache. This repository can not be used for resolving dependencies.

mavenInstaller(configureAction)

Adds a repository for installing to a local Maven cache. This repository can not be used for resolving dependencies.

Script blocks

No script blocks

Method details

FlatDirectoryArtifactRepository flatDir(Closure configureClosure)

Adds an configures a repository which will look for dependencies in a number of local directories.

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:

KeyDescription 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.
dirsSpecifies a list of rootDirs where to look for dependencies. These are evaluated as per Project.files(java.lang.Object[])

Examples:

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

Adds an configures a repository which will look for dependencies in a number of local directories.

Adds a repository which looks in Google's Maven repository for dependencies.

The URL used to access this repository is "https://dl.google.com/dl/android/maven2/".

Examples:

repositories {
    google()
}

Adds a repository which looks in Google's Maven repository for dependencies.

The URL used to access this repository is "https://dl.google.com/dl/android/maven2/".

Examples:

repositories {
    google()
}

ArtifactRepository gradlePluginPortal()

Note: This method is incubating and may change in a future version of Gradle.

Adds a repository which looks in Gradle Central Plugin Repository for dependencies.

ArtifactRepository gradlePluginPortal(Action<? super ArtifactRepository> action)

Note: This method is incubating and may change in a future version of Gradle.

Adds a repository which looks in Gradle Central Plugin Repository for dependencies.

Adds and configures an Ivy repository. Newly created instance of IvyArtifactRepository is passed as an argument to the closure.

Adds and configures an Ivy repository.

Adds a repository which looks in Bintray's JCenter repository for dependencies.

The URL used to access this repository is "https://jcenter.bintray.com/". The behavior of this repository is otherwise the same as those added by RepositoryHandler.maven(org.gradle.api.Action).

Examples:

repositories {
    jcenter()
}

Adds a repository which looks in Bintray's JCenter repository for dependencies.

The URL used to access this repository is "https://jcenter.bintray.com/". The behavior of this repository is otherwise the same as those added by RepositoryHandler.maven(org.gradle.api.Action).

Examples:

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

Adds and configures a Maven repository. Newly created instance of MavenArtifactRepository is passed as an argument to the closure.

Adds and configures a Maven repository.

Adds a repository which looks in the Maven central repository for dependencies. The URL used to access this repository is https://repo.maven.apache.org/maven2/. The name of the repository is MavenRepo.

Examples:

repositories {
    mavenCentral()
}

MavenArtifactRepository mavenCentral(Map<String, ?> args)

Adds a repository which looks in the Maven central repository for dependencies. The URL used to access this repository is https://repo.maven.apache.org/maven2/.

The following parameter are accepted as keys for the map:

KeyDescription of Associated Value
name(optional) The name of the repository. The default is MavenRepo is used as the name. A name must be unique amongst a repository group.
artifactUrlsA 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 per Project.uri(java.lang.Object).

Examples:

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

Adds a repository which looks in the Maven central repository for dependencies. The URL used to access this repository is https://repo.maven.apache.org/maven2/. The name of the repository is MavenRepo.

Examples:

repositories {
    mavenCentral()
}

Adds a repository which looks in the local Maven cache for dependencies. The name of the repository is MavenLocal.

Examples:

repositories {
    mavenLocal()
}

The location for the repository is determined as follows (in order of precedence):

  1. The value of system property 'maven.repo.local' if set;
  2. The value of element <localRepository> of ~/.m2/settings.xml if this file exists and element is set;
  3. The value of element <localRepository> of $M2_HOME/conf/settings.xml (where $M2_HOME is the value of the environment variable with that name) if this file exists and element is set;
  4. The path ~/.m2/repository.

Adds a repository which looks in the local Maven cache for dependencies. The name of the repository is MavenLocal.

Examples:

repositories {
    mavenLocal()
}

The location for the repository is determined as follows (in order of precedence):

  1. The value of system property 'maven.repo.local' if set;
  2. The value of element <localRepository> of ~/.m2/settings.xml if this file exists and element is set;
  3. The value of element <localRepository> of $M2_HOME/conf/settings.xml (where $M2_HOME is the value of the environment variable with that name) if this file exists and element is set;
  4. The path ~/.m2/repository.

GroovyMavenDeployer mavenDeployer()

Adds a repository for publishing to a Maven repository. This repository can not be used for resolving dependencies.

GroovyMavenDeployer mavenDeployer(Closure configureClosure)

Adds a repository for publishing to a Maven repository. This repository can not be used for resolving dependencies.

GroovyMavenDeployer mavenDeployer(Map<String, ?> args)

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

KeyDescription 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.

GroovyMavenDeployer mavenDeployer(Map<String, ?> args, Closure configureClosure)

Adds a repository for publishing to a Maven repository. This repository can not be used for resolving dependencies.

GroovyMavenDeployer mavenDeployer(Map<String, ?> args, Action<? super GroovyMavenDeployer> configureAction)

Adds a repository for publishing to a Maven repository. This repository can not be used for resolving dependencies.

GroovyMavenDeployer mavenDeployer(Action<? super GroovyMavenDeployer> configureAction)

Adds a repository for publishing to a Maven repository. This repository can not be used for resolving dependencies.

MavenResolver mavenInstaller()

Adds a repository for installing to a local Maven cache. This repository can not be used for resolving dependencies.

MavenResolver mavenInstaller(Closure configureClosure)

Adds a repository for installing to a local Maven cache. This repository can not be used for resolving dependencies.

MavenResolver mavenInstaller(Map<String, ?> args)

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

KeyDescription 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.

MavenResolver mavenInstaller(Map<String, ?> args, Closure configureClosure)

Adds a repository for installing to a local Maven cache. This repository can not be used for resolving dependencies.

MavenResolver mavenInstaller(Map<String, ?> args, Action<? super MavenResolver> configureAction)

Adds a repository for installing to a local Maven cache. This repository can not be used for resolving dependencies.

MavenResolver mavenInstaller(Action<? super MavenResolver> configureAction)

Adds a repository for installing to a local Maven cache. This repository can not be used for resolving dependencies.