public interface ConfigurationContainer extends NamedDomainObjectContainer<Configuration>
A ConfigurationContainer
is responsible for declaring and managing configurations. See also Configuration
.
You can obtain a ConfigurationContainer
instance by calling Project.getConfigurations()
,
or using the configurations
property in your build script.
The configurations in a container are accessible as read-only properties of the container, using the name of the configuration as the property name. For example:
configurations.create('myConfiguration') configurations.myConfiguration.transitive = false
A dynamic method is added for each configuration which takes a configuration closure. This is equivalent to
calling getByName(String, groovy.lang.Closure)
. For example:
configurations.create('myConfiguration') configurations.myConfiguration { transitive = false }
apply plugin: 'java' //so that I can use 'compile' configuration //copying all dependencies attached to 'compile' into a specific folder task copyAllDependencies(type: Copy) { //referring to the 'compile' configuration from configurations.compile into 'allLibs' }An example showing how to declare and configure configurations
apply plugin: 'java' //so that I can use 'compile', 'testCompile' configurations configurations { //adding a configuration: myConfiguration //adding a configuration that extends existing configuration: //(testCompile was added by the java plugin) myIntegrationTestsCompile.extendsFrom(testCompile) //configuring existing configurations not to put transitive dependencies on the compile classpath //this way you can avoid issues with implicit dependencies to transitive libraries compile.transitive = false testCompile.transitive = false }Examples on configuring the resolution strategy - see docs for
ResolutionStrategy
修飾子とタイプ | メソッドと説明 |
---|---|
Configuration |
detachedConfiguration(Dependency... dependencies)
Creates a configuration, but does not add it to this container.
|
Configuration |
getAt(String name)
Locates an object by name, failing if there is no such task.
|
Configuration |
getByName(String name)
Locates an object by name, failing if there is no such object.
|
Configuration |
getByName(String name,
Closure configureClosure)
Locates an object by name, failing if there is no such object.
|
configure, create, create, create, maybeCreate
findAll, matching, matching, withType
add, addAll, addRule, addRule, findByName, getAsMap, getNamer, getNames, getRules
all, all, whenObjectAdded, whenObjectAdded, whenObjectRemoved, whenObjectRemoved, withType, withType
clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray
Configuration getByName(String name) throws UnknownConfigurationException
getByName
インタフェース内 NamedDomainObjectCollection<Configuration>
name
- The object nameUnknownConfigurationException
Configuration getAt(String name) throws UnknownConfigurationException
NamedDomainObjectCollection.getByName(String)
. You can call this method in your build script by using the groovy []
operator.getAt
インタフェース内 NamedDomainObjectCollection<Configuration>
name
- The object nameUnknownConfigurationException
Configuration getByName(String name, Closure configureClosure) throws UnknownConfigurationException
getByName
インタフェース内 NamedDomainObjectCollection<Configuration>
name
- The object nameconfigureClosure
- The closure to use to configure the object.UnknownConfigurationException
Configuration detachedConfiguration(Dependency... dependencies)
dependencies
- The dependencies of the configuration.