org.gradle.api.artifacts

## Interface ArtifactRepositoryContainer

- All Superinterfaces:
    Collection<ArtifactRepository>, org.gradle.util.Configurable<ArtifactRepositoryContainer>, DomainObjectCollection<ArtifactRepository>, Iterable<ArtifactRepository>, List<ArtifactRepository>, NamedDomainObjectCollection<ArtifactRepository>, NamedDomainObjectList<ArtifactRepository>
  All Known Subinterfaces:
    RepositoryHandler

      public interface ArtifactRepositoryContainer
      extends NamedDomainObjectList<ArtifactRepository>, org.gradle.util.Configurable<ArtifactRepositoryContainer>

  A `ResolverContainer` is responsible for managing a set of `ArtifactRepository` instances. Repositories are arranged in a sequence.

  You can obtain a `ResolverContainer` instance by calling `Project.getRepositories()` or using the `repositories` property in your build script.

  The resolvers in a container are accessible as read-only properties of the container, using the name of the resolver as the property name. For example:

       repositories.maven { name 'myResolver' }
       repositories.myResolver.url = 'some-url'

  A dynamic method is added for each resolver which takes a configuration closure. This is equivalent to calling `getByName(String, groovy.lang.Closure)`. For example:

       repositories.maven { name 'myResolver' }
       repositories.myResolver {
           url 'some-url'
       }

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DEFAULT_CACHE_ARTIFACT_PATTERN` Deprecated.
    `static String` | `DEFAULT_CACHE_IVY_PATTERN` Deprecated.
    `static String` | `DEFAULT_MAVEN_CENTRAL_REPO_NAME`
    `static String` | `DEFAULT_MAVEN_LOCAL_REPO_NAME`
    `static String` | `INTERNAL_REPOSITORY_NAME` Deprecated.
    `static String` | `MAVEN_CENTRAL_URL`
    `static String` | `MAVEN_REPO_PATTERN` Deprecated.
    `static String` | `RESOLVER_NAME` Deprecated.
    `static String` | `RESOLVER_URL` Deprecated.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `add(ArtifactRepository repository)` Adds a repository to this container, at the end of the repository sequence.
    `boolean` | `add(org.apache.ivy.plugins.resolver.DependencyResolver resolver)` Deprecated. Use one of the repository methods on `RepositoryHandler` or `add(ArtifactRepository)` instead.
    `boolean` | `add(org.apache.ivy.plugins.resolver.DependencyResolver resolver, Closure configureClosure)` Deprecated. Use one of the repository methods on `RepositoryHandler` or `add(ArtifactRepository)` instead.
    `org.apache.ivy.plugins.resolver.DependencyResolver` | `addAfter(Object userDescription, String previousResolver)` Deprecated. No replacement
    `org.apache.ivy.plugins.resolver.DependencyResolver` | `addAfter(Object userDescription, String previousResolver, Closure configureClosure)` Deprecated. No replacement
    `org.apache.ivy.plugins.resolver.DependencyResolver` | `addBefore(Object userDescription, String nextResolver)` Deprecated. No replacement
    `org.apache.ivy.plugins.resolver.DependencyResolver` | `addBefore(Object userDescription, String nextResolver, Closure configureClosure)` Deprecated. No replacement
    `void` | `addFirst(ArtifactRepository repository)` Adds a repository to this container, at the start of the repository sequence.
    `org.apache.ivy.plugins.resolver.DependencyResolver` | `addFirst(Object userDescription)` Deprecated. Use `addFirst(ArtifactRepository)` instead.
    `org.apache.ivy.plugins.resolver.DependencyResolver` | `addFirst(Object userDescription, Closure configureClosure)` Deprecated. Use `addFirst(ArtifactRepository)` instead.
    `void` | `addLast(ArtifactRepository repository)` Adds a repository to this container, at the end of the repository sequence.
    `org.apache.ivy.plugins.resolver.DependencyResolver` | `addLast(Object userDescription)` Deprecated. Use `RepositoryHandler.maven(groovy.lang.Closure)` or `add(ArtifactRepository)` instead.
    `org.apache.ivy.plugins.resolver.DependencyResolver` | `addLast(Object userDescription, Closure configureClosure)` Deprecated. Use `RepositoryHandler.maven(groovy.lang.Closure)` or `add(ArtifactRepository)` instead.
    `ArtifactRepository` | `getAt(String name)` Locates an object by name, failing if there is no such task.
    `ArtifactRepository` | `getByName(String name)` Locates an object by name, failing if there is no such object.
    `ArtifactRepository` | `getByName(String name, Closure configureClosure)` Locates an object by name, failing if there is no such object.
    `List<org.apache.ivy.plugins.resolver.DependencyResolver>` | `getResolvers()` Deprecated. No replacement.

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

      `findAll, matching, matching, withType`

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

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

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

      `all, all, whenObjectAdded, whenObjectAdded, whenObjectRemoved, whenObjectRemoved, withType, withType`

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

      `clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray`

    - ### 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, retainAll, set, size, subList, toArray, toArray`

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

      `configure`

- - ### Field Detail

    - #### DEFAULT_MAVEN_CENTRAL_REPO_NAME

          static final String DEFAULT_MAVEN_CENTRAL_REPO_NAME

      See Also:
        Constant Field Values

    - #### DEFAULT_MAVEN_LOCAL_REPO_NAME

          static final String DEFAULT_MAVEN_LOCAL_REPO_NAME

      See Also:
        Constant Field Values

    - #### MAVEN_CENTRAL_URL

          static final String MAVEN_CENTRAL_URL

      See Also:
        Constant Field Values

    - #### MAVEN_REPO_PATTERN

          @Deprecated
          static final String MAVEN_REPO_PATTERN

      Deprecated.
      See Also:
        Constant Field Values

    - #### DEFAULT_CACHE_ARTIFACT_PATTERN

          @Deprecated
          static final String DEFAULT_CACHE_ARTIFACT_PATTERN

      Deprecated.
      See Also:
        Constant Field Values

    - #### DEFAULT_CACHE_IVY_PATTERN

          @Deprecated
          static final String DEFAULT_CACHE_IVY_PATTERN

      Deprecated.
      See Also:
        Constant Field Values

    - #### INTERNAL_REPOSITORY_NAME

          @Deprecated
          static final String INTERNAL_REPOSITORY_NAME

      Deprecated.
      See Also:
        Constant Field Values

    - #### RESOLVER_NAME

          @Deprecated
          static final String RESOLVER_NAME

      Deprecated.
      See Also:
        Constant Field Values

    - #### RESOLVER_URL

          @Deprecated
          static final String RESOLVER_URL

      Deprecated.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### add

          boolean add(ArtifactRepository repository)

      Adds a repository to this container, at the end of the repository sequence.
      Specified by:
        `add` in interface `Collection<ArtifactRepository>`
      Specified by:
        `add` in interface `List<ArtifactRepository>`
      Specified by:
        `add` in interface `NamedDomainObjectCollection<ArtifactRepository>`
      Parameters:
        `repository` - The repository to add.
      Returns:
        `true` if the item was added, or `` false if an item with the same name already exists.

    - #### addFirst

          void addFirst(ArtifactRepository repository)

      Adds a repository to this container, at the start of the repository sequence.
      Parameters:
        `repository` - The repository to add.

    - #### addLast

          void addLast(ArtifactRepository repository)

      Adds a repository to this container, at the end of the repository sequence.
      Parameters:
        `repository` - The repository to add.

    - #### add

          @Deprecated
          boolean add(org.apache.ivy.plugins.resolver.DependencyResolver resolver)

      Deprecated. Use one of the repository methods on `RepositoryHandler` or `add(ArtifactRepository)` instead.
      Adds a repository to this container, at the end of the repository sequence.
      Parameters:
        `resolver` - The repository to add, represented as an Ivy `DependencyResolver`.

    - #### add

          @Deprecated
          boolean add(org.apache.ivy.plugins.resolver.DependencyResolver resolver,
                               Closure configureClosure)

      Deprecated. Use one of the repository methods on `RepositoryHandler` or `add(ArtifactRepository)` instead.
      Adds a repository to this container, at the end of the repository sequence.
      Parameters:
        `resolver` - The repository to add, represented as an Ivy `DependencyResolver`.
        `configureClosure` - The closure to use to configure the repository.

    - #### addLast

          @Deprecated
          org.apache.ivy.plugins.resolver.DependencyResolver addLast(Object userDescription)
                                                                     throws InvalidUserDataException

      Deprecated. Use `RepositoryHandler.maven(groovy.lang.Closure)` or `add(ArtifactRepository)` instead.
      Adds a repository to this container, at the end of the repository sequence. The given `userDescription` can be one of:
      - A String. This is treated as a URL, and used to create a Maven repository.
      - A map. This is used to create a Maven repository. The map must contain an "name" entry and a "url" entry.
      - A `DependencyResolver`.
      - A `ArtifactRepository`.
      Parameters:
        `userDescription` - The resolver definition.
      Returns:
        The added resolver.
      Throws:
        `InvalidUserDataException` - when a resolver with the given name already exists in this container.

    - #### addLast

          @Deprecated
          org.apache.ivy.plugins.resolver.DependencyResolver addLast(Object userDescription,
                                                                              Closure configureClosure)
                                                                     throws InvalidUserDataException

      Deprecated. Use `RepositoryHandler.maven(groovy.lang.Closure)` or `add(ArtifactRepository)` instead.
      Adds a resolver to this container, at the end of the resolver sequence. The resolver is configured using the given configure closure.
      Parameters:
        `userDescription` - The resolver definition. See `addLast(Object)` for details of this parameter.
        `configureClosure` - The closure to use to configure the resolver.
      Returns:
        The added resolver.
      Throws:
        `InvalidUserDataException` - when a resolver with the given name already exists in this container.

    - #### addBefore

          @Deprecated
          org.apache.ivy.plugins.resolver.DependencyResolver addBefore(Object userDescription,
                                                                                String nextResolver)
                                                                       throws InvalidUserDataException

      Deprecated. No replacement
      Adds a resolver to this container, before the given resolver.
      Parameters:
        `userDescription` - The resolver definition. See `addLast(Object)` for details of this parameter.
        `nextResolver` - The existing resolver to add the new resolver before.
      Returns:
        The added resolver.
      Throws:
        `InvalidUserDataException` - when a resolver with the given name already exists in this container.
        `UnknownRepositoryException` - when the given next resolver does not exist in this container.

    - #### addBefore

          @Deprecated
          org.apache.ivy.plugins.resolver.DependencyResolver addBefore(Object userDescription,
                                                                                String nextResolver,
                                                                                Closure configureClosure)
                                                                       throws InvalidUserDataException

      Deprecated. No replacement
      Adds a resolver to this container, before the given resolver. The resolver is configured using the given configure closure.
      Parameters:
        `userDescription` - The resolver definition. See `addLast(Object)` for details of this parameter.
        `nextResolver` - The existing resolver to add the new resolver before.
        `configureClosure` - The closure to use to configure the resolver.
      Returns:
        The added resolver.
      Throws:
        `InvalidUserDataException` - when a resolver with the given name already exists in this container.
        `UnknownRepositoryException` - when the given next resolver does not exist in this container.

    - #### addAfter

          @Deprecated
          org.apache.ivy.plugins.resolver.DependencyResolver addAfter(Object userDescription,
                                                                               String previousResolver)
                                                                      throws InvalidUserDataException

      Deprecated. No replacement
      Adds a resolver to this container, after the given resolver.
      Parameters:
        `userDescription` - The resolver definition. See `addLast(Object)` for details of this parameter.
        `previousResolver` - The existing resolver to add the new resolver after.
      Returns:
        The added resolver.
      Throws:
        `InvalidUserDataException` - when a resolver with the given name already exists in this container.
        `UnknownRepositoryException` - when the given previous resolver does not exist in this container.

    - #### addAfter

          @Deprecated
          org.apache.ivy.plugins.resolver.DependencyResolver addAfter(Object userDescription,
                                                                               String previousResolver,
                                                                               Closure configureClosure)
                                                                      throws InvalidUserDataException

      Deprecated. No replacement
      Adds a resolver to this container, after the given resolver. The resolver is configured using the given configure closure.
      Parameters:
        `userDescription` - The resolver definition. See `addLast(Object)` for details of this parameter.
        `previousResolver` - The existing resolver to add the new resolver after.
        `configureClosure` - The closure to use to configure the resolver.
      Returns:
        The added resolver.
      Throws:
        `InvalidUserDataException` - when a resolver with the given name already exists in this container.
        `UnknownRepositoryException` - when the given previous resolver does not exist in this container.

    - #### addFirst

          @Deprecated
          org.apache.ivy.plugins.resolver.DependencyResolver addFirst(Object userDescription)
                                                                      throws InvalidUserDataException

      Deprecated. Use `addFirst(ArtifactRepository)` instead.
      Adds a resolver to this container, at the start of the resolver sequence.
      Parameters:
        `userDescription` - The resolver definition. See `addLast(Object)` for details of this parameter.
      Returns:
        The added resolver.
      Throws:
        `InvalidUserDataException` - when a resolver with the given name already exists in this container.

    - #### addFirst

          @Deprecated
          org.apache.ivy.plugins.resolver.DependencyResolver addFirst(Object userDescription,
                                                                               Closure configureClosure)
                                                                      throws InvalidUserDataException

      Deprecated. Use `addFirst(ArtifactRepository)` instead.
      Adds a resolver to this container, at the start of the resolver sequence. The resolver is configured using the given configure closure.
      Parameters:
        `userDescription` - The resolver definition. See `addLast(Object)` for details of this parameter.
        `configureClosure` - The closure to use to configure the resolver.
      Returns:
        The added resolver.
      Throws:
        `InvalidUserDataException` - when a resolver with the given name already exists in this container.

    - #### getByName

          ArtifactRepository getByName(String name)
                                       throws UnknownRepositoryException

      Locates an object by name, failing if there is no such object.
      Specified by:
        `getByName` in interface `NamedDomainObjectCollection<ArtifactRepository>`
      Parameters:
        `name` - The object name
      Returns:
        The object with the given name. Never returns null.
      Throws:
        `UnknownRepositoryException`

    - #### getByName

          ArtifactRepository getByName(String name,
                                     Closure configureClosure)
                                       throws UnknownRepositoryException

      Locates an object by name, failing if there is no such object. The given configure closure is executed against the object before it is returned from this method. The object is passed to the closure as its delegate.
      Specified by:
        `getByName` in interface `NamedDomainObjectCollection<ArtifactRepository>`
      Parameters:
        `name` - The object name
        `configureClosure` - The closure to use to configure the object.
      Returns:
        The object with the given name, after the configure closure has been applied to it. Never returns null.
      Throws:
        `UnknownRepositoryException`

    - #### getAt

          ArtifactRepository getAt(String name)
                                   throws UnknownRepositoryException

      Locates an object by name, failing if there is no such task. This method is identical to `NamedDomainObjectCollection.getByName(String)`. You can call this method in your build script by using the groovy `[]` operator.
      Specified by:
        `getAt` in interface `NamedDomainObjectCollection<ArtifactRepository>`
      Parameters:
        `name` - The object name
      Returns:
        The object with the given name. Never returns null.
      Throws:
        `UnknownRepositoryException`

    - #### getResolvers

          @Deprecated
          List<org.apache.ivy.plugins.resolver.DependencyResolver> getResolvers()

      Deprecated. No replacement.
      Returns the resolvers in this container, in sequence.
      Returns:
        The resolvers in sequence. Returns an empty list if this container is empty.