# DependencyCollector

@ManagedType
@NonExtensible
interface DependencyCollector(source)

A `DependencyCollector` is used as part of a dependencies block in the DSL. A collector implements a single dependency scope and exposes the declared dependencies on getDependencies.

To use a `DependencyCollector` as a source of dependencies, wire it to the appropriate org.gradle.api.artifacts.Configuration with fromDependencyCollector. Dependencies will be queried lazily.

Note: No mutations will be allowed after dependencies are read from a `DependencyCollector`.

#### Since

8.6

#### See also

ManagedType

Create an instance of this as a managed property (preferred).

## Functions

add
Link copied to clipboard
abstract fun add(dependencyNotation: CharSequence)
abstract fun add(dependency: Dependency)
abstract fun add(files: FileCollection)
abstract fun add(dependency: Provider<out Dependency>)
@Incubating
abstract fun add(externalModule: ProviderConvertible<out MinimalExternalModuleDependency>)
Add a dependency.
abstract fun <D : Dependency?> add(dependency: D, configuration: Action<in D>)
abstract fun add(dependencyNotation: CharSequence, configuration: Action<in ExternalModuleDependency>)
abstract fun add(files: FileCollection, configuration: Action<in FileCollectionDependency>)
abstract fun <D : Dependency?> add(dependency: Provider<out D>, configuration: Action<in D>)
@Incubating
abstract fun add(externalModule: ProviderConvertible<out MinimalExternalModuleDependency>, configuration: Action<in ExternalModuleDependency>)
Add a dependency and configure it.
addConstraint
Link copied to clipboard
abstract fun addConstraint(dependencyConstraint: DependencyConstraint)
Add a dependency constraint.
abstract fun addConstraint(dependencyConstraint: Provider<out DependencyConstraint>)
Add a dependency constraint, using a Provider to lazily create the constraint.
abstract fun addConstraint(dependencyConstraint: DependencyConstraint, configuration: Action<in DependencyConstraint>)
Add a dependency constraint and configure it.
abstract fun addConstraint(dependencyConstraint: Provider<out DependencyConstraint>, configuration: Action<in DependencyConstraint>)
Add a dependency constraint and configure it, using a Provider to lazily create the constraint.
bundle
Link copied to clipboard
@Incubating
abstract fun <D : Dependency?> bundle(bundle: Iterable<out D>)
@Incubating
abstract fun <D : Dependency?> bundle(bundle: Provider<out Iterable<out D>>)
@Incubating
abstract fun <D : Dependency?> bundle(bundle: ProviderConvertible<out Iterable<out D>>)
Add a bundle.
@Incubating
abstract fun <D : Dependency?> bundle(bundle: Iterable<out D>, configuration: Action<in D>)
@Incubating
abstract fun <D : Dependency?> bundle(bundle: Provider<out Iterable<out D>>, configuration: Action<in D>)
@Incubating
abstract fun <D : Dependency?> bundle(bundle: ProviderConvertible<out Iterable<out D>>, configuration: Action<in D>)
Add a bundle and configure them.
getDependencies
Link copied to clipboard
abstract fun getDependencies(): Provider<Set<Dependency>>
Returns all dependencies declared on this collector.
getDependencyConstraints
Link copied to clipboard
abstract fun getDependencyConstraints(): Provider<Set<DependencyConstraint>>
Returns all dependency constraints declared on this collector.
invoke
Link copied to clipboard
operator fun DependencyCollector. invoke(dependencyNotation: CharSequence)
operator fun DependencyCollector. invoke(dependency: Dependency)
operator fun DependencyCollector. invoke(files: FileCollection)
@Incubating
operator fun DependencyCollector. invoke(externalModule: ProviderConvertible<out MinimalExternalModuleDependency>)
operator fun DependencyCollector. invoke(dependency: Provider<out Dependency>)
operator fun <D : Dependency> DependencyCollector. invoke(dependency: D, configuration: Action<in D>)
operator fun DependencyCollector. invoke(dependencyNotation: CharSequence, configuration: Action<in ExternalModuleDependency>)
operator fun DependencyCollector. invoke(files: FileCollection, configuration: Action<in FileCollectionDependency>)
@Incubating
operator fun DependencyCollector. invoke(externalModule: ProviderConvertible<out MinimalExternalModuleDependency>, configuration: Action<in ExternalModuleDependency>)
operator fun <D : Dependency> DependencyCollector. invoke(dependency: Provider<out D>, configuration: Action<in D>)

Add a dependency.

operator fun DependencyCollector. invoke(dependencyConstraint: DependencyConstraint)
@JvmName(name = "invokeConstraint")
operator fun DependencyCollector. invoke(dependencyConstraint: Provider<out DependencyConstraint>)
operator fun DependencyCollector. invoke(dependencyConstraint: DependencyConstraint, configuration: Action<in DependencyConstraint>)
@JvmName(name = "invokeConstraint")
operator fun DependencyCollector. invoke(dependencyConstraint: Provider<out DependencyConstraint>, configuration: Action<in DependencyConstraint>)

Add a dependency constraint.