Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD

## org.gradle.api.artifacts
[Java] Interface ArtifactRepositoryContainer

    org.gradle.api.NamedDomainObjectCollection
      org.gradle.util.Configurable
          java.lang.Iterable
              org.gradle.api.artifacts.ArtifactRepositoryContainer
                  org.gradle.api.DomainObjectCollection
                      java.util.Collection
                          org.gradle.api.NamedDomainObjectList

All Superinterfaces:
  NamedDomainObjectCollection, Configurable, Iterable, DomainObjectCollection, Collection, NamedDomainObjectList

    public interface ArtifactRepositoryContainer
    extends Configurable, NamedDomainObjectList

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:

     resolvers.addLast(name: 'myResolver')
     resolvers.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:

     resolvers.addLast(name: 'myResolver')
     resolvers.myResolver {
         url 'some-url'
     }

Authors:
  Hans Dockter

Field Summary
`String` | `DEFAULT_CACHE_ARTIFACT_PATTERN`
`String` | `DEFAULT_CACHE_IVY_PATTERN`
`String` | `DEFAULT_MAVEN_CENTRAL_REPO_NAME`
`String` | `DEFAULT_MAVEN_LOCAL_REPO_NAME`
`String` | `INTERNAL_REPOSITORY_NAME`
`String` | `MAVEN_CENTRAL_URL`
`String` | `MAVEN_REPO_PATTERN`
`String` | `RESOLVER_NAME`
`String` | `RESOLVER_URL`

Method Summary
`boolean` | `add(ArtifactRepository repository)` Adds a repository to this container, at the end of the repository sequence.
`boolean` | `add(DependencyResolver resolver)` Adds a repository to this container, at the end of the repository sequence.
`boolean` | `add(DependencyResolver resolver, Closure configureClosure)` Adds a repository to this container, at the end of the repository sequence.
`DependencyResolver` | `addAfter(Object userDescription, String previousResolver)` Adds a resolver to this container, after the given resolver.
`DependencyResolver` | `addAfter(Object userDescription, String previousResolver, Closure configureClosure)` Adds a resolver to this container, after the given resolver.
`DependencyResolver` | `addBefore(Object userDescription, String nextResolver)` Adds a resolver to this container, before the given resolver.
`DependencyResolver` | `addBefore(Object userDescription, String nextResolver, Closure configureClosure)` Adds a resolver to this container, before the given resolver.
`void` | `addFirst(ArtifactRepository repository)` Adds a repository to this container, at the start of the repository sequence.
`DependencyResolver` | `addFirst(Object userDescription)` Adds a resolver to this container, at the start of the resolver sequence.
`DependencyResolver` | `addFirst(Object userDescription, Closure configureClosure)` Adds a resolver to this container, at the start of the resolver sequence.
`void` | `addLast(ArtifactRepository repository)` Adds a repository to this container, at the end of the repository sequence.
`DependencyResolver` | `addLast(Object userDescription)` Adds a repository to this container, at the end of the repository sequence.
`DependencyResolver` | `addLast(Object userDescription, Closure configureClosure)` Adds a resolver to this container, at the end of the resolver sequence.
`ArtifactRepository` | `getAt(String name)` {@inheritDoc}
`ArtifactRepository` | `getByName(String name)` {@inheritDoc}
`ArtifactRepository` | `getByName(String name, Closure configureClosure)` {@inheritDoc}
`List` | `getResolvers()` Returns the resolvers in this container, in sequence.

Methods inherited from interface NamedDomainObjectList
findAll, matching, matching, withType

Methods inherited from interface NamedDomainObjectCollection
add, addAll, addRule, addRule, findByName, getAsMap, getAt, getByName, getByName, getNamer, getRules, matching, matching, withType

Methods inherited from interface List
add, add, get, equals, hashCode, indexOf, clear, contains, isEmpty, lastIndexOf, size, subList, toArray, toArray, addAll, addAll, iterator, remove, remove, set, containsAll, listIterator, listIterator, removeAll, retainAll

Field Detail

### DEFAULT_CACHE_ARTIFACT_PATTERN

    public String DEFAULT_CACHE_ARTIFACT_PATTERN

### DEFAULT_CACHE_IVY_PATTERN

    public String DEFAULT_CACHE_IVY_PATTERN

### DEFAULT_MAVEN_CENTRAL_REPO_NAME

    public String DEFAULT_MAVEN_CENTRAL_REPO_NAME

### DEFAULT_MAVEN_LOCAL_REPO_NAME

    public String DEFAULT_MAVEN_LOCAL_REPO_NAME

### INTERNAL_REPOSITORY_NAME

    public String INTERNAL_REPOSITORY_NAME

### MAVEN_CENTRAL_URL

    public String MAVEN_CENTRAL_URL

### MAVEN_REPO_PATTERN

    public String MAVEN_REPO_PATTERN

### RESOLVER_NAME

    public String RESOLVER_NAME

### RESOLVER_URL

    public String RESOLVER_URL

Method Detail

### add

    public boolean add(ArtifactRepository repository)

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

### add

    public boolean add(DependencyResolver resolver)

  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

    public boolean add(DependencyResolver resolver, Closure configureClosure)

  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.

### addAfter

    public DependencyResolver addAfter(Object userDescription, String previousResolver)

  Adds a resolver to this container, after the given resolver.
  throws:
    InvalidUserDataException when a resolver with the given name already exists in this container.
  throws:
    UnknownRepositoryException when the given previous resolver does not exist in this container.
  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.

### addAfter

    public DependencyResolver addAfter(Object userDescription, String previousResolver, Closure configureClosure)

  Adds a resolver to this container, after the given resolver. The resolver is configured using the given configure closure.
  throws:
    InvalidUserDataException when a resolver with the given name already exists in this container.
  throws:
    UnknownRepositoryException when the given previous resolver does not exist in this container.
  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.

### addBefore

    public DependencyResolver addBefore(Object userDescription, String nextResolver)

  Adds a resolver to this container, before the given resolver.
  throws:
    InvalidUserDataException when a resolver with the given name already exists in this container.
  throws:
    UnknownRepositoryException when the given next resolver does not exist in this container.
  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.

### addBefore

    public DependencyResolver addBefore(Object userDescription, String nextResolver, Closure configureClosure)

  Adds a resolver to this container, before the given resolver. The resolver is configured using the given configure closure.
  throws:
    InvalidUserDataException when a resolver with the given name already exists in this container.
  throws:
    UnknownRepositoryException when the given next resolver does not exist in this container.
  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.

### addFirst

    public void addFirst(ArtifactRepository repository)

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

### addFirst

    public DependencyResolver addFirst(Object userDescription)

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

### addFirst

    public DependencyResolver addFirst(Object userDescription, Closure configureClosure)

  Adds a resolver to this container, at the start of the resolver sequence. The resolver is configured using the given configure closure.
  throws:
    InvalidUserDataException when a resolver with the given name already exists in this container.
  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.

### addLast

    public void addLast(ArtifactRepository repository)

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

### addLast

    @Deprecated
    public DependencyResolver addLast(Object userDescription)

  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 maven repository. The map must contain an {
    value:
      #RESOLVER_NAME} entry and a {@value #RESOLVER_URL} entry.
  - A org.apache.ivy.plugins.resolver.DependencyResolver.
  - A ArtifactRepository.

throws:
  InvalidUserDataException when a resolver with the given name already exists in this container.

deprecated:
  Use RepositoryHandler.maven or add(ArtifactRepository) instead.

Parameters:
  `userDescription` - The resolver definition.

Returns:
  The added resolver.

### addLast

    @Deprecated
    public DependencyResolver addLast(Object userDescription, Closure configureClosure)

  Adds a resolver to this container, at the end of the resolver sequence. The resolver is configured using the given configure closure.
  throws:
    InvalidUserDataException when a resolver with the given name already exists in this container.
  deprecated:
    Use RepositoryHandler.maven or add(ArtifactRepository) instead.
  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.

### getAt

    public ArtifactRepository getAt(String name)

  {@inheritDoc}

### getByName

    public ArtifactRepository getByName(String name)

  {@inheritDoc}

### getByName

    public ArtifactRepository getByName(String name, Closure configureClosure)

  {@inheritDoc}

### getResolvers

    public List getResolvers()

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

Gradle API 1.1-rc-1