Purpose of buildscript block in Gradle
The buildScript
block determines which plugins, task classes, and other classes are available for use in the rest of the build script. Without a buildScript
block, you can use everything that ships with Gradle out-of-the-box. If you additionally want to use third-party plugins, task classes, or other classes (in the build script!), you have to specify the corresponding dependencies in the buildScript
block.
- The global level
dependencies
andrepositories
sections list dependencies that required for building your source and running your source etc. - The
buildscript
is for thebuild.gradle
file itself. So, this would contain dependencies for say creating RPMs,Dockerfile
, and any other dependencies for running the tasks in all the dependentbuild.gradle