interface ConfigurationContainer : NamedDomainObjectContainer<Configuration>
A ConfigurationContainer
is responsible for declaring and managing configurations. See also Configuration.
You can obtain a ConfigurationContainer
instance by calling org.gradle.api.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 }
Examples An example showing how to refer to a given configuration by name in order to get hold of all dependencies (e.g. jars, but only) 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 Please see the Managing Dependency Configurations User Guide chapter for more information.
abstract fun detachedConfiguration(vararg dependencies: Dependency): Configuration
Creates a configuration, but does not add it to this container. |
|
abstract fun getAt(name: String): Configuration
{@inheritDoc} |
|
abstract fun getByName(name: String): Configuration abstract fun getByName(name: String, configureClosure: Closure<Any>): Configuration abstract fun getByName(name: String, configureAction: Action<in Configuration>): Configuration
{@inheritDoc} |
abstract fun configure(configureClosure: Closure<Any>): NamedDomainObjectContainer<T>
Allows the container to be configured, creating missing objects as they are referenced. TODO: example usage |
|
abstract fun create(name: String): T
Creates a new item with the given name, adding it to this container. abstract fun create(name: String, configureClosure: Closure<Any>): T
Creates a new item with the given name, adding it to this container, then configuring it with the given closure. abstract fun create(name: String, configureAction: Action<in T>): T
Creates a new item with the given name, adding it to this container, then configuring it with the given action. |
|
abstract fun maybeCreate(name: String): T
Looks for an item with the given name, creating and adding it to this container if it does not exist. |
val ConfigurationContainer.annotationProcessor: Configuration
The 'annotationProcessor' configuration. |
|
val ConfigurationContainer.antlr: Configuration
The 'antlr' configuration. |
|
val ConfigurationContainer.api: Configuration
The 'api' configuration. |
|
val ConfigurationContainer.apiElements: Configuration
The 'apiElements' configuration. |
|
val ConfigurationContainer.archives: Configuration
The 'archives' configuration. |
|
val ConfigurationContainer.checkstyle: Configuration
The 'checkstyle' configuration. |
|
val ConfigurationContainer.codenarc: Configuration
The 'codenarc' configuration. |
|
val ConfigurationContainer.coffeeScriptBasePluginJs: Configuration
The 'coffeeScriptBasePluginJs' configuration. |
|
val ConfigurationContainer.compile: Configuration
The 'compile' configuration. |
|
val ConfigurationContainer.compileClasspath: Configuration
The 'compileClasspath' configuration. |
|
val ConfigurationContainer.compileOnly: Configuration
The 'compileOnly' configuration. |
|
val ConfigurationContainer.default: Configuration
The 'default' configuration. |
|
val ConfigurationContainer.deploy: Configuration
The 'deploy' configuration. |
|
val ConfigurationContainer.earlib: Configuration
The 'earlib' configuration. |
|
val ConfigurationContainer.envJsPlugin: Configuration
The 'envJsPlugin' configuration. |
|
val ConfigurationContainer.findbugs: Configuration
The 'findbugs' configuration. |
|
val ConfigurationContainer.findbugsPlugins: Configuration
The 'findbugsPlugins' configuration. |
|
val ConfigurationContainer.implementation: Configuration
The 'implementation' configuration. |
|
val ConfigurationContainer.jacocoAgent: Configuration
The 'jacocoAgent' configuration. |
|
val ConfigurationContainer.jacocoAnt: Configuration
The 'jacocoAnt' configuration. |
|
val ConfigurationContainer.jdepend: Configuration
The 'jdepend' configuration. |
|
val ConfigurationContainer.jsHintPlugin: Configuration
The 'jsHintPlugin' configuration. |
|
val ConfigurationContainer.play: Configuration
The 'play' configuration. |
|
val ConfigurationContainer.playPlatform: Configuration
The 'playPlatform' configuration. |
|
val ConfigurationContainer.playRun: Configuration
The 'playRun' configuration. |
|
val ConfigurationContainer.playTest: Configuration
The 'playTest' configuration. |
|
val ConfigurationContainer.pmd: Configuration
The 'pmd' configuration. |
|
val ConfigurationContainer.providedCompile: Configuration
The 'providedCompile' configuration. |
|
val ConfigurationContainer.providedRuntime: Configuration
The 'providedRuntime' configuration. |
|
val ConfigurationContainer.rhinoPluginRhinoClasspath: Configuration
The 'rhinoPluginRhinoClasspath' configuration. |
|
val ConfigurationContainer.runtime: Configuration
The 'runtime' configuration. |
|
val ConfigurationContainer.runtimeClasspath: Configuration
The 'runtimeClasspath' configuration. |
|
val ConfigurationContainer.runtimeElements: Configuration
The 'runtimeElements' configuration. |
|
val ConfigurationContainer.runtimeOnly: Configuration
The 'runtimeOnly' configuration. |
|
val ConfigurationContainer.signatures: Configuration
The 'signatures' configuration. |
|
val ConfigurationContainer.testAnnotationProcessor: Configuration
The 'testAnnotationProcessor' configuration. |
|
val ConfigurationContainer.testCompile: Configuration
The 'testCompile' configuration. |
|
val ConfigurationContainer.testCompileClasspath: Configuration
The 'testCompileClasspath' configuration. |
|
val ConfigurationContainer.testCompileOnly: Configuration
The 'testCompileOnly' configuration. |
|
val ConfigurationContainer.testImplementation: Configuration
The 'testImplementation' configuration. |
|
val ConfigurationContainer.testRuntime: Configuration
The 'testRuntime' configuration. |
|
val ConfigurationContainer.testRuntimeClasspath: Configuration
The 'testRuntimeClasspath' configuration. |
|
val ConfigurationContainer.testRuntimeOnly: Configuration
The 'testRuntimeOnly' configuration. |
|
val ConfigurationContainer.zinc: Configuration
The 'zinc' configuration. |