AntBuilderAware
, Buildable
, FileCollection
, HasAttributes
, HasConfigurableAttributes<Configuration>
, java.lang.Iterable<java.io.File>
public interface Configuration extends FileCollection, HasConfigurableAttributes<Configuration>
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 ArtifactHandler
Please see the Declaring Dependencies User Manual chapter for more information.
Modifier and Type | Interface | Description |
---|---|---|
static class |
Configuration.Namer |
|
static class |
Configuration.State |
The states a configuration can be into.
|
FileCollection.AntType
Modifier and Type | Method | Description |
---|---|---|
Configuration |
copy() |
Creates a copy of this configuration that only contains the dependencies directly in this configuration
(without contributions from superconfigurations).
|
Configuration |
copy(Closure dependencySpec) |
Takes a closure which gets coerced into a
Spec . |
Configuration |
copy(Spec<? super Dependency> dependencySpec) |
Creates a copy of this configuration ignoring superconfigurations (see
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.
|
Configuration |
copyRecursive(Closure dependencySpec) |
Takes a closure which gets coerced into a
Spec . |
Configuration |
copyRecursive(Spec<? super Dependency> dependencySpec) |
Creates a copy of this configuration with dependencies from superconfigurations (see
copyRecursive() )
but filtering the dependencies using the dependencySpec. |
Configuration |
defaultDependencies(Action<? super DependencySet> action) |
Execute the given action if the configuration has no defined dependencies when it first participates in
dependency resolution.
|
Configuration |
disableConsistentResolution() |
Disables consistent resolution for this configuration.
|
Configuration |
exclude(java.util.Map<java.lang.String,java.lang.String> excludeProperties) |
Adds an exclude rule to exclude transitive dependencies for all dependencies of this configuration.
|
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 . |
FileCollection |
fileCollection(Dependency... dependencies) |
Resolves this configuration lazily.
|
FileCollection |
fileCollection(Spec<? super Dependency> dependencySpec) |
Resolves this configuration lazily.
|
java.util.Set<java.io.File> |
files(Closure dependencySpecClosure) |
Takes a closure which gets coerced into a
Spec . |
java.util.Set<java.io.File> |
files(Dependency... dependencies) |
Resolves this configuration.
|
java.util.Set<java.io.File> |
files(Spec<? super Dependency> dependencySpec) |
Resolves this configuration.
|
java.util.Set<Configuration> |
getAll() |
Deprecated.
|
PublishArtifactSet |
getAllArtifacts() |
Returns the artifacts of this configuration including the artifacts of extended configurations.
|
DependencySet |
getAllDependencies() |
Gets the complete set of declared dependencies including those contributed by
superconfigurations.
|
DependencyConstraintSet |
getAllDependencyConstraints() |
Gets the complete set of dependency constraints including those contributed by
superconfigurations.
|
PublishArtifactSet |
getArtifacts() |
Returns the artifacts of this configuration excluding the artifacts of extended configurations.
|
TaskDependency |
getBuildDependencies() |
Returns a
TaskDependency object containing all required dependencies to build the local dependencies
(e.g. |
DependencySet |
getDependencies() |
Gets the set of declared dependencies directly contained in this configuration
(ignoring superconfigurations).
|
DependencyConstraintSet |
getDependencyConstraints() |
Gets the set of dependency constraints directly contained in this configuration
(ignoring superconfigurations).
|
java.lang.String |
getDescription() |
Returns the description for this configuration.
|
java.util.Set<ExcludeRule> |
getExcludeRules() |
Returns the exclude rules applied for resolving any dependency of this configuration.
|
java.util.Set<Configuration> |
getExtendsFrom() |
Returns the names of the configurations which this configuration extends from.
|
java.util.Set<Configuration> |
getHierarchy() |
Gets an ordered set including this configuration and all superconfigurations
recursively.
|
ResolvableDependencies |
getIncoming() |
Returns the incoming dependencies of this configuration.
|
java.lang.String |
getName() |
Returns the name of this configuration.
|
ConfigurationPublications |
getOutgoing() |
Returns the outgoing
ConfigurationPublications instance that advertises and allows configuring the artifacts and variants published by this configuration. |
ResolutionStrategy |
getResolutionStrategy() |
Returns the resolution strategy used by this configuration.
|
ResolvedConfiguration |
getResolvedConfiguration() |
Resolves this configuration.
|
Configuration.State |
getState() |
Returns the state of the configuration.
|
TaskDependency |
getTaskDependencyFromProjectDependency(boolean useDependedOn,
java.lang.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.
|
java.lang.String |
getUploadTaskName() |
Deprecated.
|
boolean |
isCanBeConsumed() |
Returns true if this configuration can be consumed from another project, or published.
|
boolean |
isCanBeDeclared() |
Returns true if it is allowed to declare dependencies upon this configuration.
|
boolean |
isCanBeResolved() |
Returns true if it is allowed to query or resolve this configuration.
|
boolean |
isTransitive() |
Returns the transitivity of this configuration.
|
boolean |
isVisible() |
Returns true if this is a visible configuration.
|
void |
outgoing(Action<? super ConfigurationPublications> action) |
Configures the outgoing
ConfigurationPublications instance that advertises and allows configuring the artifacts and variants published by this configuration. |
Configuration |
resolutionStrategy(Closure closure) |
The resolution strategy provides extra details on how to resolve this configuration.
|
Configuration |
resolutionStrategy(Action<? super ResolutionStrategy> action) |
The resolution strategy provides extra details on how to resolve this configuration.
|
java.util.Set<java.io.File> |
resolve() |
Resolves this configuration.
|
void |
setCanBeConsumed(boolean allowed) |
Configures if a configuration can be consumed.
|
void |
setCanBeDeclared(boolean allowed) |
Configures if a configuration can have dependencies declared upon it.
|
void |
setCanBeResolved(boolean allowed) |
Configures if a configuration can be resolved.
|
Configuration |
setDescription(java.lang.String description) |
Sets the description for this configuration.
|
Configuration |
setExtendsFrom(java.lang.Iterable<Configuration> superConfigs) |
Sets the configurations which this configuration extends from.
|
Configuration |
setTransitive(boolean t) |
Sets the transitivity of this configuration.
|
Configuration |
setVisible(boolean visible) |
Sets the visibility of this configuration.
|
Configuration |
shouldResolveConsistentlyWith(Configuration versionsSource) |
Tells that this configuration, when resolved, should resolve versions consistently
from the resolution result of another resolvable configuration.
|
Configuration |
withDependencies(Action<? super DependencySet> action) |
Execute the given action before the configuration first participates in
dependency resolution.
|
addToAntBuilder, addToAntBuilder, contains, filter, filter, getAsFileTree, getAsPath, getElements, getFiles, getSingleFile, isEmpty, minus, plus
getAttributes
attributes
ResolutionStrategy getResolutionStrategy()
ResolutionStrategy
for more info and examples.Configuration resolutionStrategy(@DelegatesTo(value=ResolutionStrategy.class,strategy=1) Closure closure)
ResolutionStrategy
for more info and examples.closure
- closure applied to the ResolutionStrategy
Configuration resolutionStrategy(Action<? super ResolutionStrategy> action)
ResolutionStrategy
for more info and examples.action
- action applied to the ResolutionStrategy
Configuration.State getState()
Configuration.State
java.lang.String getName()
boolean isVisible()
Configuration setVisible(boolean visible)
visible
- true if this is a visible configurationjava.util.Set<Configuration> getExtendsFrom()
Configuration setExtendsFrom(java.lang.Iterable<Configuration> superConfigs)
superConfigs
- The super configuration. Should not be null.Configuration extendsFrom(Configuration... superConfigs)
superConfigs
- The super configurations.boolean isTransitive()
Configuration setTransitive(boolean t)
t
- true if this is a transitive configuration.@Nullable java.lang.String getDescription()
Configuration setDescription(@Nullable java.lang.String description)
description
- the description. May be nulljava.util.Set<Configuration> getHierarchy()
java.util.Set<java.io.File> resolve()
java.util.Set<java.io.File> files(Closure dependencySpecClosure)
Spec
. Behaves otherwise in the same way as
files(org.gradle.api.specs.Spec)
.dependencySpecClosure
- The closure describing a filter applied to the all the dependencies of this configuration (including dependencies from extended configurations).java.util.Set<java.io.File> files(Spec<? super Dependency> dependencySpec)
dependencySpec
- The spec describing a filter applied to the all the dependencies of this configuration (including dependencies from extended configurations).java.util.Set<java.io.File> files(Dependency... dependencies)
dependencies
- The dependencies to be resolvedFileCollection fileCollection(Spec<? super Dependency> dependencySpec)
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.dependencySpec
- The spec describing a filter applied to the all the dependencies of this configuration (including dependencies from extended configurations).FileCollection fileCollection(Closure dependencySpecClosure)
Spec
. Behaves otherwise in the same way as
fileCollection(org.gradle.api.specs.Spec)
.dependencySpecClosure
- The closure describing a filter applied to the all the dependencies of this configuration (including dependencies from extended configurations).FileCollection fileCollection(Dependency... dependencies)
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.dependencies
- The dependencies for which the FileCollection should contain the files.ResolvedConfiguration getResolvedConfiguration()
ResolvedConfiguration
that may be used to determine information about the resolve (including errors).@Deprecated java.lang.String getUploadTaskName()
Upload
TaskDependency getBuildDependencies()
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.getBuildDependencies
in interface Buildable
TaskDependency getTaskDependencyFromProjectDependency(boolean useDependedOn, java.lang.String taskName)
useDependedOn
- if true, add tasks from project dependencies in this configuration, otherwise use projects
from configurations with the same name that depend on this one.taskName
- name of task to depend onDependencySet getDependencies()
This method does not resolve the configuration. Therefore, the return value does not include transitive dependencies.
extendsFrom(Configuration...)
DependencySet getAllDependencies()
This method does not resolve the configuration. Therefore, the return value does not include transitive dependencies.
extendsFrom(Configuration...)
DependencyConstraintSet getDependencyConstraints()
DependencyConstraintSet getAllDependencyConstraints()
Gets the complete set of dependency constraints including those contributed by superconfigurations.
PublishArtifactSet getArtifacts()
PublishArtifactSet getAllArtifacts()
java.util.Set<ExcludeRule> getExcludeRules()
exclude(java.util.Map)
Configuration exclude(java.util.Map<java.lang.String,java.lang.String> excludeProperties)
ModuleDependency.exclude(java.util.Map)
.excludeProperties
- the properties to define the exclude rule.Configuration defaultDependencies(Action<? super DependencySet> action)
Configuration
will participate in dependency resolution
when:
Configuration
itself is resolvedConfiguration
that extends this one is resolvedConfiguration
that references this one as a project dependency is resolvedconfigurations { 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.
action
- the action to execute when the configuration has no defined dependencies.Configuration withDependencies(Action<? super DependencySet> action)
Configuration
will participate in dependency resolution
when:
Configuration
itself is resolvedConfiguration
that extends this one is resolvedConfiguration
that references this one as a project dependency is resolvedconfigurations { conf } configurations['conf'].withDependencies { dependencies -> dependencies.each { dependency -> if (dependency.version == null) { dependency.version { require '1.0' } } } }Actions will be executed in the order provided.
action
- a dependency action to execute before the configuration is used.@Deprecated java.util.Set<Configuration> getAll()
ResolvableDependencies getIncoming()
null
.ConfigurationPublications getOutgoing()
ConfigurationPublications
instance that advertises and allows configuring the artifacts and variants published by this configuration.
This allows adding additional artifacts and accessing and configuring variants to publish.
void outgoing(Action<? super ConfigurationPublications> action)
ConfigurationPublications
instance that advertises and allows configuring the artifacts and variants published by this configuration.action
- The action to perform the configuration.Configuration copy()
getHierarchy()
for the copy will not include any superconfigurations.
This method is only intended for use for specific situations involving resolvable configuration, it is NOT intended as a general-purpose copying mechanism.
Configuration copyRecursive()
getHierarchy()
for the copy will not include any superconfigurations.
This method is only intended for use for specific situations involving resolvable configuration, it is NOT intended as a general-purpose copying mechanism.
Configuration copy(Spec<? super Dependency> dependencySpec)
copy()
but filtering
the dependencies using the specified dependency spec.
This method is only intended for use for specific situations involving resolvable configuration, it is NOT intended as a general-purpose copying mechanism.
dependencySpec
- filtering requirementsConfiguration copyRecursive(Spec<? super Dependency> dependencySpec)
copyRecursive()
)
but filtering the dependencies using the dependencySpec.
This method is only intended for use for specific situations involving resolvable configuration, it is NOT intended as a general-purpose copying mechanism.
dependencySpec
- filtering requirementsConfiguration copy(Closure dependencySpec)
Spec
. Behaves otherwise in the same way as copy(org.gradle.api.specs.Spec)
This method is only intended for use for specific situations involving resolvable configuration, it is NOT intended as a general-purpose copying mechanism.
dependencySpec
- filtering requirementsConfiguration copyRecursive(Closure dependencySpec)
Spec
. Behaves otherwise in the same way as copyRecursive(org.gradle.api.specs.Spec)
This method is only intended for use for specific situations involving resolvable configuration, it is NOT intended as a general-purpose copying mechanism.
dependencySpec
- filtering requirementsvoid setCanBeConsumed(boolean allowed)
boolean isCanBeConsumed()
void setCanBeResolved(boolean allowed)
boolean isCanBeResolved()
@Incubating void setCanBeDeclared(boolean allowed)
@Incubating boolean isCanBeDeclared()
@Incubating Configuration shouldResolveConsistentlyWith(Configuration versionsSource)
versionsSource
- another resolvable configuration to use as reference for versions@Incubating Configuration disableConsistentResolution()