Gradle 构建脚本依赖项 [英] Gradle buildscript dependencies

查看:39
本文介绍了Gradle 构建脚本依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 gradle 构建的 buildScript 部分或构建的根级别中声明存储库有什么区别.

What is the difference between declaring repositories in the buildScript section of the gradle build or in the root level of the build.

选项 1:

build.gradle:

buildScript {
    repositories {
        mavenCentral();
    }
}

build.gradle:

repositories {
    mavenCentral();
}

推荐答案

buildScript 块中的存储库用于获取 buildScript 依赖项的依赖项.这些是放在构建类路径上的依赖项,您可以从构建文件中引用它们.例如,互联网上存在的额外插件.

The repositories in the buildScript block are used to fetch the dependencies of your buildScript dependencies. These are the dependencies that are put on the classpath of your build and that you can refer to from your build file. For instance extra plugins that exist on the internet.

根级别的存储库用于获取您的项目所依赖的依赖项.编译项目所需的所有依赖项.

The repositories on the root level are used to fetch the dependencies that your project depends on. So all the dependencies you need to compile your project.

这篇关于Gradle 构建脚本依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆