The closure passed to the buildscript() method configures a ScriptHandler instance. You declare the build script classpath by adding dependencies to the classpath configuration. This is the same way you declare, for example, the Java compilation classpath. You can use any of the dependency types described in Section 25.4, “How to declare your dependencies”, except project dependencies.
Having declared the build script classpath, you can use the classes in your build script as you would any other classes on the classpath.
而 ScriptHandler 的源码注释写的是：
To declare the script classpath, you use the DependencyHandler provided by getDependencies() to attach dependencies to the “classpath” configuration. These dependencies are resolved just prior to script compilation, and assembled into the classpath for the script.
Settings evaluated using settings file '/Path/To/Your/Project/settings.gradle'.
Projects loaded. Root project using build file '/Path/To/Your/Project/build.gradle'.
Included projects: [root project 'Your-Project', project ':app']
Evaluating root project 'Your-Project' using build file '/Path/To/Your/Project/build.gradle'.
Hello Second Line
Creating new cache for metadata-2.23/module-metadata, path /Users/2bab/.gradle/caches/modules-2/metadata-2.23/module-metadata.bin, access org.gradle.cache.internal.DefaultCacheAccess@24473bd5
Creating new cache for metadata-2.23/artifact-at-repository, path /Users/2bab/.gradle/caches/modules-2/metadata-2.23/artifact-at-repository.bin, access org.gradle.cache.internal.DefaultCacheAccess@24473bd5
Hello First Line
Hello Third Line
Evaluating project ':app' using build file '/Path/To/Your/Project/app/build.gradle'.