RepositoryHandler (Gradle API 7.6.3)

Package org.gradle.api.artifacts.dsl

## Interface RepositoryHandler

- All Superinterfaces:
    `ArtifactRepositoryContainer`, `java.util.Collection<ArtifactRepository>`, `Configurable<ArtifactRepositoryContainer>`, `DomainObjectCollection<ArtifactRepository>`, `java.lang.Iterable<ArtifactRepository>`, `java.util.List<ArtifactRepository>`, `NamedDomainObjectCollection<ArtifactRepository>`, `NamedDomainObjectList<ArtifactRepository>`

      public interface RepositoryHandler
      extends ArtifactRepositoryContainer

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

- - ### Field Summary

    - ### Fields inherited from interface org.gradle.api.artifacts.ArtifactRepositoryContainer

      `DEFAULT_MAVEN_CENTRAL_REPO_NAME, DEFAULT_MAVEN_LOCAL_REPO_NAME, GOOGLE_URL, MAVEN_CENTRAL_URL`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `exclusiveContent​(Action<? super ExclusiveContentRepository> action)` | Declares exclusive content repositories.
    `FlatDirectoryArtifactRepository` | `flatDir​(Closure configureClosure)` | Adds an configures a repository which will look for dependencies in a number of local directories.
    `FlatDirectoryArtifactRepository` | `flatDir​(java.util.Map<java.lang.String,​?> args)` | Adds a resolver that looks into a number of directories for artifacts.
    `FlatDirectoryArtifactRepository` | `flatDir​(Action<? super FlatDirectoryArtifactRepository> action)` | Adds an configures a repository which will look for dependencies in a number of local directories.
    `MavenArtifactRepository` | `google()` | Adds a repository which looks in Google's Maven repository for dependencies.
    `MavenArtifactRepository` | `google​(Action<? super MavenArtifactRepository> action)` | Adds a repository which looks in Google's Maven repository for dependencies.
    `ArtifactRepository` | `gradlePluginPortal()` | Adds a repository which looks in Gradle Central Plugin Repository for dependencies.
    `ArtifactRepository` | `gradlePluginPortal​(Action<? super ArtifactRepository> action)` | Adds a repository which looks in Gradle Central Plugin Repository for dependencies.
    `IvyArtifactRepository` | `ivy​(Closure closure)` | Adds and configures an Ivy repository.
    `IvyArtifactRepository` | `ivy​(Action<? super IvyArtifactRepository> action)` | Adds and configures an Ivy repository.
    `MavenArtifactRepository` | `jcenter()` | Deprecated. JFrog announced JCenter's sunset in February 2021.
    `MavenArtifactRepository` | `jcenter​(Action<? super MavenArtifactRepository> action)` | Deprecated. JFrog announced JCenter's sunset in February 2021.
    `MavenArtifactRepository` | `maven​(Closure closure)` | Adds and configures a Maven repository.
    `MavenArtifactRepository` | `maven​(Action<? super MavenArtifactRepository> action)` | Adds and configures a Maven repository.
    `MavenArtifactRepository` | `mavenCentral()` | Adds a repository which looks in the Maven central repository for dependencies.
    `MavenArtifactRepository` | `mavenCentral​(java.util.Map<java.lang.String,​?> args)` | Adds a repository which looks in the Maven central repository for dependencies.
    `MavenArtifactRepository` | `mavenCentral​(Action<? super MavenArtifactRepository> action)` | 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.
    `MavenArtifactRepository` | `mavenLocal​(Action<? super MavenArtifactRepository> action)` | Adds a repository which looks in the local Maven cache for dependencies.

    - ### Methods inherited from interface org.gradle.api.artifacts.ArtifactRepositoryContainer

      `add, addFirst, addLast, getAt, getByName, getByName, getByName`

    - ### Methods inherited from interface java.util.Collection

      `parallelStream, removeIf, stream, toArray`

    - ### Methods inherited from interface org.gradle.util.Configurable

      `configure`

    - ### Methods inherited from interface org.gradle.api.DomainObjectCollection

      `addAllLater, addLater, all, all, configureEach, whenObjectAdded, whenObjectAdded, whenObjectRemoved, whenObjectRemoved, withType, withType`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach`

    - ### Methods inherited from interface java.util.List

      `add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray`

    - ### Methods inherited from interface org.gradle.api.NamedDomainObjectCollection

      `addAll, addRule, addRule, addRule, findByName, getAsMap, getCollectionSchema, getNamer, getNames, getRules, named, named, named, named`

    - ### Methods inherited from interface org.gradle.api.NamedDomainObjectList

      `findAll, matching, matching, withType`

- - ### Method Detail

    - #### flatDir

          FlatDirectoryArtifactRepository flatDir​(java.util.Map<java.lang.String,​?> 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 per `Project.files(Object...)`

      Examples:

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

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

    - #### flatDir

          FlatDirectoryArtifactRepository flatDir​(@DelegatesTo(FlatDirectoryArtifactRepository.class)
                                                  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

          FlatDirectoryArtifactRepository flatDir​(Action<? super FlatDirectoryArtifactRepository> 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.

    - #### gradlePluginPortal

          ArtifactRepository gradlePluginPortal()

      Adds a repository which looks in Gradle Central Plugin Repository for dependencies.
      Returns:
        The Gradle Central Plugin Repository
      Since:
        4.4

    - #### gradlePluginPortal

          ArtifactRepository gradlePluginPortal​(Action<? super ArtifactRepository> action)

      Adds a repository which looks in Gradle Central Plugin Repository for dependencies.
      Parameters:
        `action` - a configuration action
      Returns:
        the added resolver
      Since:
        5.4

    - #### jcenter

          @Deprecated
          MavenArtifactRepository jcenter​(Action<? super MavenArtifactRepository> action)

      Deprecated.
      JFrog announced JCenter's sunset in February 2021. Use `mavenCentral()` instead.
      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 `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"]
             }
           }

      Parameters:
        `action` - a configuration action
      Returns:
        the added repository

    - #### jcenter

          @Deprecated
          MavenArtifactRepository jcenter()

      Deprecated.
      JFrog announced JCenter's sunset in February 2021. Use `mavenCentral()` instead.
      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 `maven(org.gradle.api.Action)`.

      Examples:

           repositories {
               jcenter()
           }

      Returns:
        the added resolver
      See Also:
        `jcenter(Action)`

    - #### mavenCentral

          MavenArtifactRepository mavenCentral​(java.util.Map<java.lang.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:

      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"]
           }

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

    - #### mavenCentral

          MavenArtifactRepository 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".

      Examples:

           repositories {
               mavenCentral()
           }

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

    - #### mavenCentral

          MavenArtifactRepository mavenCentral​(Action<? super MavenArtifactRepository> 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".

      Examples:

           repositories {
               mavenCentral()
           }

      Parameters:
        `action` - a configuration action
      Returns:
        the added resolver
      Since:
        5.3

    - #### mavenLocal

          MavenArtifactRepository mavenLocal()

      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`.
      Returns:
        the added resolver

    - #### mavenLocal

          MavenArtifactRepository mavenLocal​(Action<? super MavenArtifactRepository> action)

      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`.
      Parameters:
        `action` - a configuration action
      Returns:
        the added resolver
      Since:
        5.3

    - #### google

          MavenArtifactRepository 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()
           }

      Returns:
        the added resolver
      Since:
        4.0

    - #### google

          MavenArtifactRepository google​(Action<? super MavenArtifactRepository> action)

      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()
           }

      Parameters:
        `action` - a configuration action
      Returns:
        the added resolver
      Since:
        5.3

    - #### maven

          MavenArtifactRepository maven​(@DelegatesTo(MavenArtifactRepository.class)
                                        Closure closure)

      Adds and configures a Maven repository. Newly created instance of `MavenArtifactRepository` is passed as an argument to the closure.
      Parameters:
        `closure` - The closure to use to configure the repository.
      Returns:
        The added repository.

    - #### maven

          MavenArtifactRepository maven​(Action<? super MavenArtifactRepository> action)

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

    - #### ivy

          IvyArtifactRepository ivy​(@DelegatesTo(IvyArtifactRepository.class)
                                    Closure closure)

      Adds and configures an Ivy repository. Newly created instance of `IvyArtifactRepository` is passed as an argument to the closure.
      Parameters:
        `closure` - The closure to use to configure the repository.
      Returns:
        The added repository.

    - #### ivy

          IvyArtifactRepository ivy​(Action<? super IvyArtifactRepository> action)

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

    - #### exclusiveContent

          void exclusiveContent​(Action<? super ExclusiveContentRepository> action)

      Declares exclusive content repositories. Exclusive content repositories are repositories for which you can declare an inclusive content filter. Artifacts matching the filter will then only be searched in the repositories which exclusively match it.
      Parameters:
        `action` - the configuration of the repositories
      Since:
        6.2