Package org.gradle.api.artifacts.dsl

# Interface DependencyFactory

@NonExtensible public interface DependencyFactory
Factory class for creating `Dependency` instances, with strong typing.

An instance of the factory can be injected into a task, plugin or other object by annotating a public constructor or property getter method with `javax.inject.Inject`. It is also available via `Project.getDependencyFactory()`.

Note: This interface is not intended for implementation by build script or plugin authors.

Since:
  7.6

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ExternalModuleDependency`
  `create(@Nullable String group, String name, @Nullable String version)`
  Create an `ExternalModuleDependency` from a series of strings.
  `ExternalModuleDependency`
  `create(@Nullable String group, String name, @Nullable String version, @Nullable String classifier, @Nullable String extension)`
  Create an `ExternalModuleDependency` from a series of strings.
  `ExternalModuleDependency`
  `create(CharSequence dependencyNotation)`
  Create an `ExternalModuleDependency` from the `"group:name:version:classifier@extension"` notation.
  `FileCollectionDependency`
  `create(FileCollection fileCollection)`
  Create a `FileCollectionDependency` from a `FileCollection`.
  `ProjectDependency`
  `create(Project project)`
  Deprecated.
  Use `createProjectDependency(String)` instead.
  `ProjectDependency`
  `createProjectDependency()`
  Create a `ProjectDependency` for the current project.
  `ProjectDependency`
  `createProjectDependency(String projectPath)`
  Create a `ProjectDependency` from a `Project` path.
  `Dependency`
  `gradleApi()`
  Creates a dependency on the API of the current version of Gradle.
  `Dependency`
  `gradleTestKit()`
  Creates a dependency on the Gradle test-kit API.
  `Dependency`
  `localGroovy()`
  Creates a dependency on the version of Groovy that is distributed with the current version of Gradle.

- ## Method Details

  - ### create

    ExternalModuleDependency create(CharSequence dependencyNotation)
    Create an `ExternalModuleDependency` from the `"group:name:version:classifier@extension"` notation.

    Classifier and extension may each separately be omitted. Version may be omitted if there is no classifier.

    Parameters:
      `dependencyNotation` - the dependency notation
    Returns:
      the new dependency

  - ### create

    ExternalModuleDependency create(@Nullable String group, String name, @Nullable String version)
    Create an `ExternalModuleDependency` from a series of strings.
    Parameters:
      `group` - the group (optional)
      `name` - the name
      `version` - the version (optional)
    Returns:
      the new dependency

  - ### create

    ExternalModuleDependency create(@Nullable String group, String name, @Nullable String version, @Nullable String classifier, @Nullable String extension)
    Create an `ExternalModuleDependency` from a series of strings.
    Parameters:
      `group` - the group (optional)
      `name` - the name
      `version` - the version (optional)
      `classifier` - the classifier (optional)
      `extension` - the extension (optional)
    Returns:
      the new dependency

  - ### create

    FileCollectionDependency create(FileCollection fileCollection)
    Create a `FileCollectionDependency` from a `FileCollection`.
    Parameters:
      `fileCollection` - the file collection
    Returns:
      the new dependency

  - ### create

    @Deprecated ProjectDependency create(Project project)
    Deprecated.
    Use `createProjectDependency(String)` instead. This method will be removed in Gradle 10.0.
    Create a `ProjectDependency` from a `Project`.
    Parameters:
      `project` - the project
    Returns:
      the new dependency

  - ### createProjectDependency

    @Incubating ProjectDependency createProjectDependency(String projectPath)
    Create a `ProjectDependency` from a `Project` path.
    Parameters:
      `projectPath` - the project
    Returns:
      the new dependency
    Since:
      9.5.0

  - ### createProjectDependency

    @Incubating ProjectDependency createProjectDependency()
    Create a `ProjectDependency` for the current project.
    Returns:
      the new dependency
    Since:
      9.5.0

  - ### gradleApi

    Dependency gradleApi()
    Creates a dependency on the API of the current version of Gradle.
    Returns:
      The dependency.
    Since:
      7.6

  - ### gradleTestKit

    Dependency gradleTestKit()
    Creates a dependency on the Gradle test-kit API.
    Returns:
      The dependency.
    Since:
      7.6

  - ### localGroovy

    Dependency localGroovy()
    Creates a dependency on the version of Groovy that is distributed with the current version of Gradle.
    Returns:
      The dependency.
    Since:
      7.6