Gradle distribution-specific dependencies
Gradle provides special dependency notations for projects that build Gradle plugins or tools that integrate with Gradle.
Using these dependencies ensures compatibility with Gradle’s internal APIs while keeping plugin and build logic development streamlined.
Gradle API dependency
You can declare a dependency on the API of the current version of Gradle by using the DependencyHandler.gradleApi()
method.
This is useful when you are developing custom Gradle tasks or plugins:
dependencies {
implementation(gradleApi())
}
dependencies {
implementation gradleApi()
}
Gradle TestKit dependency
You can declare a dependency on the TestKit
API of the current version of Gradle by using the DependencyHandler.gradleTestKit()
method.
This is useful for writing and executing functional tests for Gradle plugins and build scripts:
dependencies {
testImplementation(gradleTestKit())
}
dependencies {
testImplementation gradleTestKit()
}
The TestKit chapter explains the use of TestKit
by example.
Local Groovy dependency
You can declare a dependency on the Groovy that is distributed with Gradle by using the DependencyHandler.localGroovy()
method.
This is useful when you are developing custom Gradle tasks or plugins in Groovy:
dependencies {
implementation(localGroovy())
}
dependencies {
implementation localGroovy()
}