Configuration - Gradle DSL Version 2.14.1

# Configuration

API Documentation: | `Configuration`

A `Configuration` represents a group of artifacts and their dependencies. Find more information about declaring dependencies to a configuration or about managing configurations in docs for `ConfigurationContainer`

Configuration is an instance of a `FileCollection` that contains all dependencies (see also `Configuration.getAllDependencies()`) but not artifacts. If you want to refer to the artifacts declared in this configuration please use `Configuration.getArtifacts()` or `Configuration.getAllArtifacts()`. Read more about declaring artifacts in the configuration in docs for `ArtifactHandler`

### Properties

Property | Description
`allArtifacts` | The artifacts of this configuration including the artifacts of extended configurations.
`allDependencies` | Gets the complete set of dependencies including those contributed by superconfigurations.
`artifacts` | The artifacts of this configuration excluding the artifacts of extended configurations.
`buildDependencies` | Returns a `TaskDependency` object containing all required dependencies to build the internal dependencies (e.g. project dependencies) belonging to this configuration or to one of its super configurations.
`dependencies` | Gets the set of dependencies directly contained in this configuration (ignoring superconfigurations).
`description` | The description for this configuration.
`excludeRules` | The exclude rules applied for resolving any dependency of this configuration.
`extendsFrom` | The names of the configurations which this configuration extends from. The artifacts of the super configurations are also available in this configuration.
`hierarchy` | Gets a ordered set including this configuration and all superconfigurations recursively.
`incoming` | The incoming dependencies of this configuration.
`name` | The name of this configuration.
`resolutionStrategy` | The resolution strategy used by this configuration. The resolution strategy provides extra details on how to resolve this configuration. See docs for `ResolutionStrategy` for more info and examples.
`resolvedConfiguration` | Resolves this configuration. This locates and downloads the files which make up this configuration, and returns a ResolvedConfiguration that may be used to determine information about the resolve (including errors).
`state` | A `Configuration` represents a group of artifacts and their dependencies. Find more information about declaring dependencies to a configuration or about managing configurations in docs for `ConfigurationContainer`
`transitive` | The transitivity of this configuration. A transitive configuration contains the transitive closure of its direct dependencies, and all their dependencies. An intransitive configuration contains only the direct dependencies. The default value is true.
`visible` | Returns true if this is a visible configuration. A visible configuration is usable outside the project it belongs to. The default value is true.

### Methods

Method | Description
`copy()` | Creates a copy of this configuration that only contains the dependencies directly in this configuration (without contributions from superconfigurations). The new configuration will be in the UNRESOLVED state, but will retain all other attributes of this configuration except superconfigurations. `Configuration.getHierarchy()` for the copy will not include any superconfigurations.
`copy(dependencySpec)` | Takes a closure which gets coerced into a Spec. Behaves otherwise in the same way as `Configuration.copy(org.gradle.api.specs.Spec)`
`copy(dependencySpec)` | Creates a copy of this configuration ignoring superconfigurations (see `Configuration.copy()` but filtering the dependencies using the specified dependency spec.
`copyRecursive()` | Creates a copy of this configuration that contains the dependencies directly in this configuration and those derived from superconfigurations. The new configuration will be in the UNRESOLVED state, but will retain all other attributes of this configuration except superconfigurations. `Configuration.getHierarchy()` for the copy will not include any superconfigurations.
`copyRecursive(dependencySpec)` | Takes a closure which gets coerced into a Spec. Behaves otherwise in the same way as `Configuration.copyRecursive(org.gradle.api.specs.Spec)`
`copyRecursive(dependencySpec)` | Creates a copy of this configuration with dependencies from superconfigurations (see `Configuration.copyRecursive()`) but filtering the dependencies using the dependencySpec.
`defaultDependencies(action)` | Incubating Execute the given action if the configuration has no defined dependencies when it first participates in dependency resolution. A `Configuration` will participate in dependency resolution when:
`exclude(excludeProperties)` | Adds an exclude rule to exclude transitive dependencies for all dependencies of this configuration. You can also add exclude rules per-dependency. See `ModuleDependency.exclude(java.util.Map)`.
`extendsFrom(superConfigs)` | Adds the given configurations to the set of configuration which this configuration extends from.
`fileCollection(dependencySpecClosure)` | Takes a closure which gets coerced into a Spec. Behaves otherwise in the same way as `Configuration.fileCollection(org.gradle.api.specs.Spec)`.
`fileCollection(dependencies)` | Resolves this configuration lazily. The resolve happens when the elements of the returned FileCollection get accessed the first time. This locates and downloads the files which make up this configuration. Only the resulting set of files belonging to specified dependencies is contained in the FileCollection.
`fileCollection(dependencySpec)` | Resolves this configuration lazily. The resolve happens when the elements of the returned FileCollection get accessed the first time. This locates and downloads the files which make up this configuration. Only the resulting set of files belonging to the subset of dependencies specified by the dependencySpec is contained in the FileCollection.
`files(dependencySpecClosure)` | Takes a closure which gets coerced into a Spec. Behaves otherwise in the same way as `Configuration.files(org.gradle.api.specs.Spec)`.
`files(dependencies)` | Resolves this configuration. This locates and downloads the files which make up this configuration. But only the resulting set of files belonging to the specified dependencies is returned.
`files(dependencySpec)` | Resolves this configuration. This locates and downloads the files which make up this configuration. But only the resulting set of files belonging to the subset of dependencies specified by the dependencySpec is returned.
`getTaskDependencyFromProjectDependency(useDependedOn, taskName)` | Returns a TaskDependency object containing dependencies on all tasks with the specified name from project dependencies related to this configuration or one of its super configurations. These other projects may be projects this configuration depends on or projects with a similarly named configuration that depend on this one based on the useDependOn argument.

### Script blocks

No script blocks

### Property details

#### `PublishArtifactSet` `allArtifacts` (read-only)

The artifacts of this configuration including the artifacts of extended configurations.

#### `DependencySet` `allDependencies` (read-only)

Gets the complete set of dependencies including those contributed by superconfigurations.

#### `PublishArtifactSet` `artifacts` (read-only)

The artifacts of this configuration excluding the artifacts of extended configurations.

#### `TaskDependency` `buildDependencies` (read-only)

Returns a `TaskDependency` object containing all required dependencies to build the internal dependencies (e.g. project dependencies) belonging to this configuration or to one of its super configurations.

#### `DependencySet` `dependencies` (read-only)

Gets the set of dependencies directly contained in this configuration (ignoring superconfigurations).

#### `String` `description`

The description for this configuration.

#### ``Set`<`ExcludeRule`>` `excludeRules` (read-only)

The exclude rules applied for resolving any dependency of this configuration.

#### ``Set`<`Configuration`>` `extendsFrom`

The names of the configurations which this configuration extends from. The artifacts of the super configurations are also available in this configuration.

#### ``Set`<`Configuration`>` `hierarchy` (read-only)

Gets a ordered set including this configuration and all superconfigurations recursively.

#### `ResolvableDependencies` `incoming` (read-only)

The incoming dependencies of this configuration.

#### `String` `name` (read-only)

The name of this configuration.

#### `ResolutionStrategy` `resolutionStrategy` (read-only)

The resolution strategy used by this configuration. The resolution strategy provides extra details on how to resolve this configuration. See docs for `ResolutionStrategy` for more info and examples.

#### `ResolvedConfiguration` `resolvedConfiguration` (read-only)

Resolves this configuration. This locates and downloads the files which make up this configuration, and returns a ResolvedConfiguration that may be used to determine information about the resolve (including errors).

#### `State` `state` (read-only)

A `Configuration` represents a group of artifacts and their dependencies. Find more information about declaring dependencies to a configuration or about managing configurations in docs for `ConfigurationContainer`

Configuration is an instance of a `FileCollection` that contains all dependencies (see also `Configuration.getAllDependencies()`) but not artifacts. If you want to refer to the artifacts declared in this configuration please use `Configuration.getArtifacts()` or `Configuration.getAllArtifacts()`. Read more about declaring artifacts in the configuration in docs for `ArtifactHandler`

#### `boolean` `transitive`

The transitivity of this configuration. A transitive configuration contains the transitive closure of its direct dependencies, and all their dependencies. An intransitive configuration contains only the direct dependencies. The default value is true.

#### `boolean` `visible`

Returns true if this is a visible configuration. A visible configuration is usable outside the project it belongs to. The default value is true.

### Method details

#### `Configuration` `copy`()

Creates a copy of this configuration that only contains the dependencies directly in this configuration (without contributions from superconfigurations). The new configuration will be in the UNRESOLVED state, but will retain all other attributes of this configuration except superconfigurations. `Configuration.getHierarchy()` for the copy will not include any superconfigurations.

#### `Configuration` `copy`(`Closure` dependencySpec)

Takes a closure which gets coerced into a Spec. Behaves otherwise in the same way as `Configuration.copy(org.gradle.api.specs.Spec)`

#### `Configuration` `copy`(``Spec`<? super `Dependency`>` dependencySpec)

Creates a copy of this configuration ignoring superconfigurations (see `Configuration.copy()` but filtering the dependencies using the specified dependency spec.

#### `Configuration` `copyRecursive`()

Creates a copy of this configuration that contains the dependencies directly in this configuration and those derived from superconfigurations. The new configuration will be in the UNRESOLVED state, but will retain all other attributes of this configuration except superconfigurations. `Configuration.getHierarchy()` for the copy will not include any superconfigurations.

#### `Configuration` `copyRecursive`(`Closure` dependencySpec)

Takes a closure which gets coerced into a Spec. Behaves otherwise in the same way as `Configuration.copyRecursive(org.gradle.api.specs.Spec)`

#### `Configuration` `copyRecursive`(``Spec`<? super `Dependency`>` dependencySpec)

Creates a copy of this configuration with dependencies from superconfigurations (see `Configuration.copyRecursive()`) but filtering the dependencies using the dependencySpec.

#### `Configuration` `defaultDependencies`(``Action`<? super `DependencySet`>` action)

Note: This method is incubating and may change in a future version of Gradle.

Execute the given action if the configuration has no defined dependencies when it first participates in dependency resolution. A `Configuration` will participate in dependency resolution when:

- The `Configuration` itself is resolved
- Another `Configuration` that extends this one is resolved
- Another `Configuration` that references this one as a project dependency is resolved

This method is useful for specifying default dependencies for a configuration:

    configurations { conf }
    configurations['conf'].defaultDependencies { dependencies ->
         dependencies.add(owner.project.dependencies.create("org.gradle:my-util:1.0"))
    }

A `Configuration` is considered empty even if it extends another, non-empty `Configuration`. If multiple actions are supplied, each action will be executed until the set of dependencies is no longer empty. Remaining actions will be ignored.

#### `Configuration` `exclude`(``Map`<`String`, `String`>` excludeProperties)

Adds an exclude rule to exclude transitive dependencies for all dependencies of this configuration. You can also add exclude rules per-dependency. See `ModuleDependency.exclude(java.util.Map)`.

#### `Configuration` `extendsFrom`(``Configuration`...` superConfigs)

Adds the given configurations to the set of configuration which this configuration extends from.

#### `FileCollection` `fileCollection`(`Closure` dependencySpecClosure)

Takes a closure which gets coerced into a Spec. Behaves otherwise in the same way as `Configuration.fileCollection(org.gradle.api.specs.Spec)`.

#### `FileCollection` `fileCollection`(``Dependency`...` dependencies)

Resolves this configuration lazily. The resolve happens when the elements of the returned FileCollection get accessed the first time. This locates and downloads the files which make up this configuration. Only the resulting set of files belonging to specified dependencies is contained in the FileCollection.

#### `FileCollection` `fileCollection`(``Spec`<? super `Dependency`>` dependencySpec)

Resolves this configuration lazily. The resolve happens when the elements of the returned FileCollection get accessed the first time. This locates and downloads the files which make up this configuration. Only the resulting set of files belonging to the subset of dependencies specified by the dependencySpec is contained in the FileCollection.

#### ``Set`<`File`>` `files`(`Closure` dependencySpecClosure)

Takes a closure which gets coerced into a Spec. Behaves otherwise in the same way as `Configuration.files(org.gradle.api.specs.Spec)`.

#### ``Set`<`File`>` `files`(``Dependency`...` dependencies)

Resolves this configuration. This locates and downloads the files which make up this configuration. But only the resulting set of files belonging to the specified dependencies is returned.

#### ``Set`<`File`>` `files`(``Spec`<? super `Dependency`>` dependencySpec)

Resolves this configuration. This locates and downloads the files which make up this configuration. But only the resulting set of files belonging to the subset of dependencies specified by the dependencySpec is returned.

#### `TaskDependency` `getTaskDependencyFromProjectDependency`(`boolean` useDependedOn, `String` taskName)

Returns a TaskDependency object containing dependencies on all tasks with the specified name from project dependencies related to this configuration or one of its super configurations. These other projects may be projects this configuration depends on or projects with a similarly named configuration that depend on this one based on the useDependOn argument.