# Configuration

interface Configuration : FileCollection, HasConfigurableAttributes<SELF> , 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.

#### Inheritors

DependencyScopeConfiguration
ConsumableConfiguration
ResolvableConfiguration
LegacyConfiguration

## 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)
attributes
Link copied to clipboard
abstract fun attributes(action: Action<in AttributeContainer>): SELF
contains
Link copied to clipboard
abstract fun contains(file: File): Boolean
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
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
forEach
Link copied to clipboard
open fun forEach(p: 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
getAsPath
Link copied to clipboard
abstract fun getAsPath(): String
getAttributes
Link copied to clipboard
abstract fun getAttributes(): AttributeContainer
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>>
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 names of the configurations which this configuration extends from.
getFiles
Link copied to clipboard
abstract fun getFiles(): Set<File>
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
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
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
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
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
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.