ConfigurationContainer (Gradle API 2.14)
Date: 2016-06-14

org.gradle.api.artifacts

## Interface ConfigurationContainer

- All Superinterfaces:
    Collection<Configuration>, org.gradle.util.Configurable<NamedDomainObjectContainer<Configuration>>, DomainObjectCollection<Configuration>, Iterable<Configuration>, NamedDomainObjectCollection<Configuration>, NamedDomainObjectContainer<Configuration>, NamedDomainObjectSet<Configuration>, Set<Configuration>

      public interface ConfigurationContainer
      extends NamedDomainObjectContainer<Configuration>

  A `ConfigurationContainer` is responsible for declaring and managing configurations. See also `Configuration`.

  You can obtain a `ConfigurationContainer` instance by calling `Project.getConfigurations()`, or using the `configurations` property in your build script.

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

       configurations.create('myConfiguration')
       configurations.myConfiguration.transitive = false

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

       configurations.create('myConfiguration')
       configurations.myConfiguration {
           transitive = false
       }

  ## Examples

  An example showing how to refer to a given configuration by name in order to get hold of all dependencies (e.g. jars, but only)

         apply plugin: 'java' //so that I can use 'compile' configuration

         //copying all dependencies attached to 'compile' into a specific folder
         task copyAllDependencies(type: Copy) {
           //referring to the 'compile' configuration
           from configurations.compile
           into 'allLibs'
         }

  An example showing how to declare and configure configurations

       apply plugin: 'java' //so that I can use 'compile', 'testCompile' configurations

       configurations {
         //adding a configuration:
         myConfiguration

         //adding a configuration that extends existing configuration:
         //(testCompile was added by the java plugin)
         myIntegrationTestsCompile.extendsFrom(testCompile)

         //configuring existing configurations not to put transitive dependencies on the compile classpath
         //this way you can avoid issues with implicit dependencies to transitive libraries
         compile.transitive = false
         testCompile.transitive = false
       }

  Examples on configuring the resolution strategy - see docs for `ResolutionStrategy`

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Configuration` | `detachedConfiguration(Dependency... dependencies)` Creates a configuration, but does not add it to this container.
    `Configuration` | `getAt(String name)` Locates an object by name, failing if there is no such task.
    `Configuration` | `getByName(String name)` Locates an object by name, failing if there is no such object.
    `Configuration` | `getByName(String name, Closure configureClosure)` Locates an object by name, failing if there is no such object.

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

      `configure, create, create, create, maybeCreate`

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

      `findAll, matching, matching, withType`

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

      `add, 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.Set

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

- - ### Method Detail

    - #### getByName

          Configuration getByName(String name)
                                  throws UnknownConfigurationException

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

    - #### getAt

          Configuration getAt(String name)
                              throws UnknownConfigurationException

      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<Configuration>`
      Parameters:
        `name` - The object name
      Returns:
        The object with the given name. Never returns null.
      Throws:
        `UnknownConfigurationException`

    - #### getByName

          Configuration getByName(String name,
                                Closure configureClosure)
                                  throws UnknownConfigurationException

      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<Configuration>`
      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:
        `UnknownConfigurationException`

    - #### detachedConfiguration

          Configuration detachedConfiguration(Dependency... dependencies)

      Creates a configuration, but does not add it to this container.
      Parameters:
        `dependencies` - The dependencies of the configuration.
      Returns:
        The configuration.