# Configuration

interface Configuration : FileCollection, HasConfigurableAttributes<Configuration> , Named(source)

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 getAllDependencies) but not artifacts. If you want to refer to the artifacts declared in this configuration please use getArtifacts or getAllArtifacts. Read more about declaring artifacts in the configuration in docs for org.gradle.api.artifacts.dsl.ArtifactHandler Please see the Declaring Dependencies User Manual chapter for more information.

#### Since

0.7

#### Inheritors

LegacyConfiguration
DependencyScopeConfiguration
ResolvableConfiguration
ConsumableConfiguration

## Types

State
Link copied to clipboard
enum State
The states a configuration can be into.

## Functions

addToAntBuilder
Link copied to clipboard
abstract fun addToAntBuilder(builder: Any, nodeName: String): Any
abstract fun addToAntBuilder(builder: Any, nodeName: String, type: FileCollection.AntType)
Adds this collection to an Ant task as a nested node.
abstract fun addToAntBuilder(node: Any, childNodeName: String): Any
Add to ant builder.
attributes
Link copied to clipboard
abstract fun attributes(action: Action<in AttributeContainer>): SELF
Configure the attribute container that provides the attributes associated with this domain object.
contains
Link copied to clipboard
abstract fun contains(file: File): Boolean
Determines whether this collection contains the given file.
copy
Link copied to clipboard
abstract fun copy(): Configuration
Creates a copy of this configuration that only contains the dependencies directly in this configuration (without contributions from superconfigurations).
abstract fun copy(dependencySpec: Closure): Configuration
Takes a closure which gets coerced into a Spec.
abstract fun copy(dependencySpec: Spec<in Dependency>): Configuration
Creates a copy of this configuration ignoring superconfigurations (see copy but filtering the dependencies using the specified dependency spec.
copyRecursive
Link copied to clipboard
abstract fun copyRecursive(): Configuration
Creates a copy of this configuration that contains the dependencies directly in this configuration and those derived from superconfigurations.
abstract fun copyRecursive(dependencySpec: Closure): Configuration
Takes a closure which gets coerced into a Spec.
abstract fun copyRecursive(dependencySpec: Spec<in Dependency>): Configuration
Creates a copy of this configuration with dependencies from superconfigurations (see copyRecursive) but filtering the dependencies using the dependencySpec.
defaultDependencies
Link copied to clipboard
abstract fun defaultDependencies(action: Action<in DependencySet>): Configuration
Execute the given action if the configuration has no defined dependencies when it first participates in dependency resolution.
disableConsistentResolution
Link copied to clipboard
@Incubating
abstract fun disableConsistentResolution(): Configuration
Disables consistent resolution for this configuration.
exclude
Link copied to clipboard
abstract fun exclude(excludeProperties: Map<String, String>): Configuration
Adds an exclude rule to exclude transitive dependencies for all dependencies of this configuration.
exclude
Link copied to clipboard
fun Configuration. exclude(group: String? = null, module: String? = null): Configuration

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.

extendsFrom
Link copied to clipboard
abstract fun extendsFrom(superConfigs: Array<Configuration>): Configuration
@Incubating
abstract fun extendsFrom(superConfigs: Array<Provider<out Configuration>>): Configuration
Adds the given configurations to the set of configuration which this configuration extends from.
filter
Link copied to clipboard
abstract fun filter(filterClosure: Closure): FileCollection
abstract fun filter(filterSpec: Spec<in File>): FileCollection
Restricts the contents of this collection to those files which match the given criteria.
forEach
Link copied to clipboard
open fun forEach(action: Consumer<in T>)
fromDependencyCollector
Link copied to clipboard
@Incubating
open fun fromDependencyCollector(collector: DependencyCollector)
Use the given collector as a source for dependencies and dependency constraints.
getAllArtifacts
Link copied to clipboard
abstract fun getAllArtifacts(): PublishArtifactSet
Returns the artifacts of this configuration including the artifacts of extended configurations.
getAllDependencies
Link copied to clipboard
abstract fun getAllDependencies(): DependencySet
Gets the complete set of declared dependencies including those contributed by superconfigurations.
getAllDependencyConstraints
Link copied to clipboard
abstract fun getAllDependencyConstraints(): DependencyConstraintSet
Gets the complete set of dependency constraints including those contributed by superconfigurations.
getArtifacts
Link copied to clipboard
abstract fun getArtifacts(): PublishArtifactSet
Returns the artifacts of this configuration excluding the artifacts of extended configurations.
getAsFileTree
Link copied to clipboard
abstract fun getAsFileTree(): FileTree
Converts this collection to a FileTree, if not already.
getAsPath
Link copied to clipboard
abstract fun getAsPath(): String
Returns the contents of this collection as a platform-specific path.
getAttributes
Link copied to clipboard
abstract fun getAttributes(): AttributeContainer
Returns the attributes
getBuildDependencies
Link copied to clipboard
abstract fun getBuildDependencies(): TaskDependency
Returns a `TaskDependency` object containing all required dependencies to build the local dependencies (e.g.
getDependencies
Link copied to clipboard
abstract fun getDependencies(): DependencySet
Gets the set of declared dependencies directly contained in this configuration (ignoring superconfigurations).
getDependencyConstraints
Link copied to clipboard
abstract fun getDependencyConstraints(): DependencyConstraintSet
Gets the set of dependency constraints directly contained in this configuration (ignoring superconfigurations).
getDescription
Link copied to clipboard
@Nullable
abstract fun getDescription(): @Nullable String
Returns the description for this configuration.
getElements
Link copied to clipboard
abstract fun getElements(): Provider<Set<FileSystemLocation>>
Returns the contents of this file collection as a Provider of FileSystemLocation instances.
getExcludeRules
Link copied to clipboard
abstract fun getExcludeRules(): Set<ExcludeRule>
Returns the exclude rules applied for resolving any dependency of this configuration.
getExtendsFrom
Link copied to clipboard
abstract fun getExtendsFrom(): Set<Configuration>
Returns the configurations which this configuration extends from.
getFiles
Link copied to clipboard
abstract fun getFiles(): Set<File>
Returns the contents of this collection as a Set.
getHierarchy
Link copied to clipboard
abstract fun getHierarchy(): Set<Configuration>
Gets an ordered set including this configuration and all superconfigurations recursively.
getIncoming
Link copied to clipboard
abstract fun getIncoming(): ResolvableDependencies
Returns a ResolvableDependencies instance, exposing the results of dependency resolution.
getName
Link copied to clipboard
abstract fun getName(): String
The object's name.
getOutgoing
Link copied to clipboard
abstract fun getOutgoing(): ConfigurationPublications
Returns the outgoing ConfigurationPublications instance that advertises and allows configuring the artifacts and variants published by this configuration.
getResolutionStrategy
Link copied to clipboard
abstract fun getResolutionStrategy(): ResolutionStrategy
Returns the resolution strategy used by this configuration.
getResolvedConfiguration
Link copied to clipboard
abstract fun getResolvedConfiguration(): ResolvedConfiguration
Returns a ResolvedConfiguration, a legacy view of the results of dependency resolution.
getSingleFile
Link copied to clipboard
abstract fun getSingleFile(): File
Returns the content of this collection, asserting it contains exactly one file.
getState
Link copied to clipboard
abstract fun getState(): Configuration.State
Returns the state of the configuration.
getTaskDependencyFromProjectDependency
Link copied to clipboard
abstract fun getTaskDependencyFromProjectDependency(useDependedOn: Boolean, taskName: String): TaskDependency
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.
isCanBeConsumed
Link copied to clipboard
abstract fun isCanBeConsumed(): Boolean
Returns true if this configuration can be consumed from another project, or published.
isCanBeDeclared
Link copied to clipboard
@Incubating
abstract fun isCanBeDeclared(): Boolean
Returns true if it is allowed to declare dependencies upon this configuration.
isCanBeResolved
Link copied to clipboard
abstract fun isCanBeResolved(): Boolean
Returns true if it is allowed to query or resolve this configuration.
isEmpty
Link copied to clipboard
abstract fun isEmpty(): Boolean
Returns true if this collection is empty.
isTransitive
Link copied to clipboard
abstract fun isTransitive(): Boolean
Returns the transitivity of this configuration.
isVisible
Link copied to clipboard
abstract fun isVisible(): Boolean
This is a legacy property and the value does not affect dependency resolution in any way.
iterator
Link copied to clipboard
abstract fun iterator(): Iterator<T>
minus
Link copied to clipboard
abstract fun minus(collection: FileCollection): FileCollection
Returns a `FileCollection` which contains the difference between this collection and the given collection.
outgoing
Link copied to clipboard
abstract fun outgoing(action: Action<in ConfigurationPublications>)
Configures the outgoing ConfigurationPublications instance that advertises and allows configuring the artifacts and variants published by this configuration.
plus
Link copied to clipboard
abstract fun plus(collection: FileCollection): FileCollection
Returns a `FileCollection` which contains the union of this collection and the given collection.
resolutionStrategy
Link copied to clipboard
abstract fun resolutionStrategy(@DelegatesTo(value = ResolutionStrategy::class, strategy = 1) closure: Closure): Configuration
abstract fun resolutionStrategy(action: Action<in ResolutionStrategy>): Configuration
The resolution strategy provides extra details on how to resolve this configuration.
resolve
Link copied to clipboard
abstract fun resolve(): Set<File>
Resolves this configuration.
setCanBeConsumed
Link copied to clipboard
abstract fun setCanBeConsumed(allowed: Boolean)
Configures if a configuration can be consumed.
setCanBeDeclared
Link copied to clipboard
@Incubating
abstract fun setCanBeDeclared(allowed: Boolean)
Configures if a configuration can have dependencies declared upon it.
setCanBeResolved
Link copied to clipboard
abstract fun setCanBeResolved(allowed: Boolean)
Configures if a configuration can be resolved.
setDescription
Link copied to clipboard
abstract fun setDescription(@Nullable description: @Nullable String): Configuration
Sets the description for this configuration.
setExtendsFrom
Link copied to clipboard
abstract fun setExtendsFrom(superConfigs: Iterable<Configuration>): Configuration
Sets the configurations which this configuration extends from.
setTransitive
Link copied to clipboard
abstract fun setTransitive(t: Boolean): Configuration
Sets the transitivity of this configuration.
setVisible
Link copied to clipboard
abstract fun setVisible(visible: Boolean): Configuration
Sets the value returned by isVisible.
shouldResolveConsistentlyWith
Link copied to clipboard
@Incubating
abstract fun shouldResolveConsistentlyWith(versionsSource: Configuration): Configuration
Tells that this configuration, when resolved, should resolve versions consistently from the resolution result of another resolvable configuration.
spliterator
Link copied to clipboard
open fun spliterator(): Spliterator<T>
withDependencies
Link copied to clipboard
abstract fun withDependencies(action: Action<in DependencySet>): Configuration
Execute the given action before the configuration first participates in dependency resolution.