Package org.gradle.api.artifacts

## Interface ArtifactRepositoryContainer

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

      public interface ArtifactRepositoryContainer
      extends NamedDomainObjectList<ArtifactRepository>, 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 | Description
    --- | --- | ---
    `static java.lang.String` | `DEFAULT_MAVEN_CENTRAL_REPO_NAME` |
    `static java.lang.String` | `DEFAULT_MAVEN_LOCAL_REPO_NAME` |
    `static java.lang.String` | `GOOGLE_URL` |
    `static java.lang.String` | `MAVEN_CENTRAL_URL` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `add​(ArtifactRepository repository)` | Adds a repository to this container, at the end of the repository sequence.
    `void` | `addFirst​(ArtifactRepository repository)` | Adds a repository to this container, at the start of the repository sequence.
    `void` | `addLast​(ArtifactRepository repository)` | Adds a repository to this container, at the end of the repository sequence.
    `ArtifactRepository` | `getAt​(java.lang.String name)` | Locates an object by name, failing if there is no such object.
    `ArtifactRepository` | `getByName​(java.lang.String name)` | Locates an object by name, failing if there is no such object.
    `ArtifactRepository` | `getByName​(java.lang.String name, Closure configureClosure)` | Locates an object by name, failing if there is no such object.
    `ArtifactRepository` | `getByName​(java.lang.String name, Action<? super ArtifactRepository> configureAction)` | Locates an object by name, failing if there is no such object.

    - ### 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`

- - ### Field Detail

    - #### DEFAULT_MAVEN_CENTRAL_REPO_NAME

          static final java.lang.String DEFAULT_MAVEN_CENTRAL_REPO_NAME

      See Also:
        Constant Field Values

    - #### DEFAULT_MAVEN_LOCAL_REPO_NAME

          static final java.lang.String DEFAULT_MAVEN_LOCAL_REPO_NAME

      See Also:
        Constant Field Values

    - #### MAVEN_CENTRAL_URL

          static final java.lang.String MAVEN_CENTRAL_URL

      See Also:
        Constant Field Values

    - #### GOOGLE_URL

          static final java.lang.String GOOGLE_URL

      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 `java.util.Collection<ArtifactRepository>`
      Specified by:
        `add` in interface `java.util.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.

    - #### getByName

          ArtifactRepository getByName​(java.lang.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​(java.lang.String name,
                                       @DelegatesTo(ArtifactRepository.class)
                                       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`

    - #### getByName

          ArtifactRepository getByName​(java.lang.String name,
                                       Action<? super ArtifactRepository> configureAction)
                                throws UnknownRepositoryException

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

    - #### getAt

          ArtifactRepository getAt​(java.lang.String name)
                            throws UnknownRepositoryException

      Locates an object by name, failing if there is no such object. 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`