public interface RepositoryHandler extends ArtifactRepositoryContainer
RepositoryHandler
manages a set of repositories, allowing repositories to be defined and queried.DEFAULT_MAVEN_CENTRAL_REPO_NAME, DEFAULT_MAVEN_LOCAL_REPO_NAME, MAVEN_CENTRAL_URL
Modifier and Type | Method and Description |
---|---|
FlatDirectoryArtifactRepository |
flatDir(Action<? super FlatDirectoryArtifactRepository> action)
Adds an configures a repository which will look for dependencies in a number of local directories.
|
FlatDirectoryArtifactRepository |
flatDir(Closure configureClosure)
Adds an configures a repository which will look for dependencies in a number of local directories.
|
FlatDirectoryArtifactRepository |
flatDir(Map<String,?> args)
Adds a resolver that looks into a number of directories for artifacts.
|
IvyArtifactRepository |
ivy(Action<? super IvyArtifactRepository> action)
Adds and configures an Ivy repository.
|
IvyArtifactRepository |
ivy(Closure closure)
Adds and configures an Ivy repository.
|
MavenArtifactRepository |
jcenter()
Adds a repository which looks in Bintray's JCenter repository for dependencies.
|
MavenArtifactRepository |
jcenter(Action<? super MavenArtifactRepository> action)
Adds a repository which looks in Bintray's JCenter repository for dependencies.
|
MavenArtifactRepository |
maven(Action<? super MavenArtifactRepository> action)
Adds and configures a Maven repository.
|
MavenArtifactRepository |
maven(Closure closure)
Adds and configures a Maven repository.
|
MavenArtifactRepository |
mavenCentral()
Adds a repository which looks in the Maven central repository for dependencies.
|
MavenArtifactRepository |
mavenCentral(Map<String,?> args)
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.
|
add, addFirst, addLast, getAt, getByName, getByName
findAll, matching, matching, withType
addAll, addRule, addRule, findByName, getAsMap, getNamer, getNames, getRules
all, all, whenObjectAdded, whenObjectAdded, whenObjectRemoved, whenObjectRemoved, withType, withType
clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
FlatDirectoryArtifactRepository flatDir(Map<String,?> args)
":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 per Project.files(Object...) |
Examples:
repositories { flatDir name: 'libs', dirs: "$projectDir/libs" flatDir dirs: ["$projectDir/libs1", "$projectDir/libs2"] }
args
- The arguments used to configure the repository.InvalidUserDataException
- In the case neither rootDir nor rootDirs is specified of if both
are specified.FlatDirectoryArtifactRepository flatDir(Closure configureClosure)
configureClosure
- The closure to execute to configure the repository.FlatDirectoryArtifactRepository flatDir(Action<? super FlatDirectoryArtifactRepository> action)
action
- The action to execute to configure the repository.MavenArtifactRepository jcenter(Action<? super MavenArtifactRepository> action)
The URL used to access this repository is "http://jcenter.bintray.com/".
The behavior of this resolver is otherwise the same as the ones added by 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"] } }
action
- a configuration actionMavenArtifactRepository jcenter()
The URL used to access this repository is "http://jcenter.bintray.com/".
The behavior of this resolver is otherwise the same as the ones added by mavenCentral()
.
Examples:
repositories { jcenter() }
jcenter(Action)
MavenArtifactRepository mavenCentral(Map<String,?> args)
Key | Description 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. |
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 per Project.uri(Object) . |
Examples:
repositories { mavenCentral artifactUrls: ["http://www.mycompany.com/artifacts1", "http://www.mycompany.com/artifacts2"] mavenCentral name: "nonDefaultName", artifactUrls: ["http://www.mycompany.com/artifacts1"] }
args
- A list of urls of repositories to look for artifacts only.MavenArtifactRepository mavenCentral()
Examples:
repositories { mavenCentral() }
mavenCentral(java.util.Map)
MavenArtifactRepository mavenLocal()
Examples:
repositories { mavenLocal() }
MavenArtifactRepository maven(Closure closure)
closure
- The closure to use to configure the repository.MavenArtifactRepository maven(Action<? super MavenArtifactRepository> action)
action
- The action to use to configure the repository.IvyArtifactRepository ivy(Closure closure)
closure
- The closure to use to configure the repository.IvyArtifactRepository ivy(Action<? super IvyArtifactRepository> action)
action
- The action to use to configure the repository.