Table of Contents
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
Please see the Managing Dependency Configurations User Manual chapter for more information.
Property | Description |
allArtifacts | The artifacts of this configuration including the artifacts of extended configurations. |
allDependencies | Gets the complete set of declared dependencies including those contributed by superconfigurations. |
artifacts | The artifacts of this configuration excluding the artifacts of extended configurations. |
buildDependencies | Returns a |
dependencies | Gets the set of declared 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 |
resolvedConfiguration | Resolves this configuration. This locates and downloads the files which make up this configuration, and returns
a |
state | The state of the configuration. |
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. |
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.
|
copy(dependencySpec) | Takes a closure which gets coerced into a |
copy(dependencySpec) | Creates a copy of this configuration ignoring superconfigurations (see |
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.
|
copyRecursive(dependencySpec) | Takes a closure which gets coerced into a |
copyRecursive(dependencySpec) | Creates a copy of this configuration with dependencies from superconfigurations (see |
defaultDependencies(action) | Execute the given action if the configuration has no defined dependencies when it first participates in
dependency resolution. A |
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 |
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 |
fileCollection(dependencies) | Resolves this configuration lazily. The resolve happens when the elements of the returned |
fileCollection(dependencySpec) | Resolves this configuration lazily. The resolve happens when the elements of the returned |
files(dependencySpecClosure) | Takes a closure which gets coerced into a |
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. |
The artifacts of this configuration including the artifacts of extended configurations.
Gets the complete set of declared dependencies including those contributed by superconfigurations.
This method does not resolve the configuration. Therefore, the return value does not include transitive dependencies.
The artifacts of this configuration excluding the artifacts of extended configurations.
Returns a TaskDependency
object containing all required dependencies to build the local dependencies
(e.g. project dependencies) belonging to this configuration or to one of its super configurations.
Gets the set of declared dependencies directly contained in this configuration (ignoring superconfigurations).
This method does not resolve the configuration. Therefore, the return value does not include transitive dependencies.
The description for this configuration.
The exclude rules applied for resolving any dependency of this configuration.
The names of the configurations which this configuration extends from. The artifacts of the super configurations are also available in this configuration.
Gets a ordered set including this configuration and all superconfigurations recursively.
The incoming dependencies of this configuration.
The name of this configuration.
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.
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).
The state of the configuration.
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.
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)
Spec
<? super Dependency
>Creates a copy of this configuration ignoring superconfigurations (see Configuration.copy()
but filtering
the dependencies using the specified dependency spec.
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)
Spec
<? super Dependency
>Creates a copy of this configuration with dependencies from superconfigurations (see Configuration.copyRecursive()
)
but filtering the dependencies using the dependencySpec.
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.
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)
.
Adds the given configurations to the set of configuration which this configuration extends from.
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)
Dependency
...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)
Spec
<? super Dependency
>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.
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)
Set
<File
>Dependency
...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)
Set
<File
>Spec
<? super Dependency
>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.
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.