Package org.gradle.api.artifacts.dsl

## Interface DependencyCollector

-     @Incubating
      @NonExtensible
      public interface DependencyCollector

  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()`.
  Since:
    8.6
  API Note:
    Gradle has specific extensions to make explicit calls to `add(...)` unnecessary from the DSL.
    - For Groovy DSL, we create `call(...)` equivalents for all the `add(...)` methods.
    - For Kotlin DSL, we create `invoke(...)` equivalents for all the `add(...)` methods.
  Implementation Requirements:
    This interface should not be implemented by end users or plugins.
  Implementation Note:
    Changes to this interface may require changes to the `extension module for Groovy DSL` or `extension functions for Kotlin DSL`.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `<D extends Dependency> void` | `add​(D dependency, Action<? super D> configuration)` | Add a dependency and configure it.
    `void` | `add​(java.lang.CharSequence dependencyNotation)` | Add a dependency.
    `void` | `add​(java.lang.CharSequence dependencyNotation, Action<? super ExternalModuleDependency> configuration)` | Add a dependency and configure it.
    `void` | `add​(Dependency dependency)` | Add a dependency.
    `void` | `add​(FileCollection files)` | Add a dependency.
    `void` | `add​(FileCollection files, Action<? super FileCollectionDependency> configuration)` | Add a dependency and configure it.
    `<D extends Dependency> void` | `add​(Provider<? extends D> dependency, Action<? super D> configuration)` | Add a dependency and configure it.
    `void` | `add​(Provider<? extends Dependency> dependency)` | Add a dependency.
    `void` | `add​(ProviderConvertible<? extends MinimalExternalModuleDependency> externalModule)` | Add a dependency.
    `void` | `add​(ProviderConvertible<? extends MinimalExternalModuleDependency> externalModule, Action<? super ExternalModuleDependency> configuration)` | Add a dependency and configure it.
    `void` | `addConstraint​(DependencyConstraint dependencyConstraint)` | Add a dependency constraint.
    `void` | `addConstraint​(DependencyConstraint dependencyConstraint, Action<? super DependencyConstraint> configuration)` | Add a dependency constraint and configure it.
    `void` | `addConstraint​(Provider<? extends DependencyConstraint> dependencyConstraint)` | Add a dependency constraint, using a `Provider` to lazily create the constraint.
    `void` | `addConstraint​(Provider<? extends DependencyConstraint> dependencyConstraint, Action<? super DependencyConstraint> configuration)` | Add a dependency constraint and configure it, using a `Provider` to lazily create the constraint.
    `<D extends Dependency> void` | `bundle​(java.lang.Iterable<? extends D> bundle)` | Add a bundle.
    `<D extends Dependency> void` | `bundle​(java.lang.Iterable<? extends D> bundle, Action<? super D> configuration)` | Add a bundle and configure them.
    `<D extends Dependency> void` | `bundle​(Provider<? extends java.lang.Iterable<? extends D>> bundle)` | Add a bundle.
    `<D extends Dependency> void` | `bundle​(Provider<? extends java.lang.Iterable<? extends D>> bundle, Action<? super D> configuration)` | Add a bundle and configure them.
    `<D extends Dependency> void` | `bundle​(ProviderConvertible<? extends java.lang.Iterable<? extends D>> bundle)` | Add a bundle.
    `<D extends Dependency> void` | `bundle​(ProviderConvertible<? extends java.lang.Iterable<? extends D>> bundle, Action<? super D> configuration)` | Add a bundle and configure them.
    `Provider<java.util.Set<Dependency>>` | `getDependencies()` | Returns all dependencies declared on this collector.
    `Provider<java.util.Set<DependencyConstraint>>` | `getDependencyConstraints()` | Returns all dependency constraints declared on this collector.

- - ### Method Detail

    - #### add

          void add​(java.lang.CharSequence dependencyNotation)

      Add a dependency.
      Parameters:
        `dependencyNotation` - dependency to add
      Since:
        8.6
      See Also:
        `Valid dependency notation for this method`

    - #### add

          void add​(java.lang.CharSequence dependencyNotation,
                   Action<? super ExternalModuleDependency> configuration)

      Add a dependency and configure it.
      Parameters:
        `dependencyNotation` - dependency to add
        `configuration` - an action to configure the dependency
      Since:
        8.6
      See Also:
        `Valid dependency notation for this method`

    - #### add

          void add​(FileCollection files)

      Add a dependency.
      Parameters:
        `files` - files to add as a dependency
      Since:
        8.6
      See Also:
        `DependencyFactory.create(FileCollection)`

    - #### add

          void add​(FileCollection files,
                   Action<? super FileCollectionDependency> configuration)

      Add a dependency and configure it.
      Parameters:
        `files` - files to add as a dependency
        `configuration` - an action to configure the dependency
      Since:
        8.6
      See Also:
        `DependencyFactory.create(FileCollection)`

    - #### add

          void add​(ProviderConvertible<? extends MinimalExternalModuleDependency> externalModule)

      Add a dependency.
      Parameters:
        `externalModule` - external module to add as a dependency
      Since:
        8.6

    - #### add

          void add​(ProviderConvertible<? extends MinimalExternalModuleDependency> externalModule,
                   Action<? super ExternalModuleDependency> configuration)

      Add a dependency and configure it.
      Parameters:
        `externalModule` - external module to add as a dependency
        `configuration` - an action to configure the dependency
      Since:
        8.6

    - #### add

          void add​(Dependency dependency)

      Add a dependency.
      Parameters:
        `dependency` - dependency to add
      Since:
        8.6

    - #### add

          <D extends Dependency> void add​(D dependency,
                                          Action<? super D> configuration)

      Add a dependency and configure it.
      Parameters:
        `dependency` - dependency to add
        `configuration` - an action to configure the dependency
      Since:
        8.6

    - #### add

          void add​(Provider<? extends Dependency> dependency)

      Add a dependency.
      Parameters:
        `dependency` - dependency to add
      Since:
        8.6

    - #### add

          <D extends Dependency> void add​(Provider<? extends D> dependency,
                                          Action<? super D> configuration)

      Add a dependency and configure it.
      Parameters:
        `dependency` - dependency to add
        `configuration` - an action to configure the dependency
      Since:
        8.6

    - #### addConstraint

          void addConstraint​(DependencyConstraint dependencyConstraint)

      Add a dependency constraint.
      Parameters:
        `dependencyConstraint` - dependency constraint to add
      Since:
        8.7

    - #### addConstraint

          void addConstraint​(DependencyConstraint dependencyConstraint,
                             Action<? super DependencyConstraint> configuration)

      Add a dependency constraint and configure it.
      Parameters:
        `dependencyConstraint` - dependency constraint to add
        `configuration` - an action to configure the dependency constraint
      Since:
        8.7

    - #### addConstraint

          void addConstraint​(Provider<? extends DependencyConstraint> dependencyConstraint)

      Add a dependency constraint, using a `Provider` to lazily create the constraint.
      Parameters:
        `dependencyConstraint` - dependency constraint to add
      Since:
        8.7

    - #### addConstraint

          void addConstraint​(Provider<? extends DependencyConstraint> dependencyConstraint,
                             Action<? super DependencyConstraint> configuration)

      Add a dependency constraint and configure it, using a `Provider` to lazily create the constraint.
      Parameters:
        `dependencyConstraint` - dependency constraint to add
        `configuration` - an action to configure the dependency constraint
      Since:
        8.7

    - #### bundle

          <D extends Dependency> void bundle​(java.lang.Iterable<? extends D> bundle)

      Add a bundle.
      Parameters:
        `bundle` - the bundle to add
      Since:
        8.6

    - #### bundle

          <D extends Dependency> void bundle​(java.lang.Iterable<? extends D> bundle,
                                             Action<? super D> configuration)

      Add a bundle and configure them.
      Parameters:
        `bundle` - the bundle to add
        `configuration` - an action to configure each dependency in the bundle
      Since:
        8.6

    - #### bundle

          <D extends Dependency> void bundle​(Provider<? extends java.lang.Iterable<? extends D>> bundle)

      Add a bundle.
      Parameters:
        `bundle` - the bundle to add
      Since:
        8.6

    - #### bundle

          <D extends Dependency> void bundle​(Provider<? extends java.lang.Iterable<? extends D>> bundle,
                                             Action<? super D> configuration)

      Add a bundle and configure them.
      Parameters:
        `bundle` - the bundle to add
        `configuration` - an action to configure each dependency in the bundle
      Since:
        8.6

    - #### bundle

          <D extends Dependency> void bundle​(ProviderConvertible<? extends java.lang.Iterable<? extends D>> bundle)

      Add a bundle.
      Parameters:
        `bundle` - the bundle to add
      Since:
        8.6

    - #### bundle

          <D extends Dependency> void bundle​(ProviderConvertible<? extends java.lang.Iterable<? extends D>> bundle,
                                             Action<? super D> configuration)

      Add a bundle and configure them.
      Parameters:
        `bundle` - the bundle to add
        `configuration` - an action to configure each dependency in the bundle
      Since:
        8.6

    - #### getDependencies

          Provider<java.util.Set<Dependency>> getDependencies()

      Returns all dependencies declared on this collector.
      Since:
        8.6

    - #### getDependencyConstraints

          Provider<java.util.Set<DependencyConstraint>> getDependencyConstraints()

      Returns all dependency constraints declared on this collector.
      Since:
        8.7