If your build script needs to use external libraries, you can add them to the script’s classpath in the build script itself. You do this using the buildscript() method, passing in a block which declares the build script classpath.
You declare the build script classpath by adding dependencies to the classpath configuration
What are dependency configurations
link
Every dependency declared for a Gradle project applies to a specific scope. For example some dependencies should be used for compiling source code whereas others only need to be available at runtime. Gradle represents the scope of a dependency with the help of a Configuration. Every configuration can be identified by a unique name.
For example, if I want to express that my application app depends on library lib, we need at least one configuration:
configurations {
// declare a "configuration" named "someConfiguration"
someConfiguration
}
dependencies {
// add a project dependency to the "someConfiguration" configuration
someConfiguration project(":lib")
}
The Java plugin adds Java compilation along with testing and bundling capabilities to a project. It serves as the basis for many of the other JVM language Gradle plugins
External dependencies for the build script
If your build script needs to use external libraries, you can add them to the script’s classpath in the build script itself. You do this using the
buildscript()
method, passing in a block which declares the build script classpath.You declare the build script classpath by adding dependencies to the classpath configuration
What are dependency configurations
link Every dependency declared for a Gradle project applies to a specific scope. For example some dependencies should be used for compiling source code whereas others only need to be available at runtime. Gradle represents the scope of a dependency with the help of a Configuration. Every configuration can be identified by a unique name.
For example, if I want to express that my application app depends on library lib, we need at least one configuration: