Java build.gradle:编译组 vs 编译、构建脚本、类路径
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39480226/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
build.gradle: compile group vs compile, buildscript, classpath
提问by yooouuri
What is the difference between "compile group" and "compile"? Just another way to define a dependency?
“编译组”和“编译”有什么区别?只是定义依赖项的另一种方式?
Ex:
前任:
compile group: 'org.slf4j', name: 'slf4j-jcl', version: '1.7.21'
And i think this also will work:
而且我认为这也将起作用:
compile("org.slf4j:slf4j-jcl:1.7.21")
Why do i have the declare mavenCentral()
again and another dependencies block inside the buildscript block?
为什么我mavenCentral()
在 buildscript 块中再次声明和另一个依赖项块?
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.0.RELEASE")
}
}
From my point of view, when you compile something it will be in your classPath?
从我的角度来看,当你编译一些东西时,它会在你的 classPath 中吗?
采纳答案by larsgrefer
compile
specifies an external dependency for the project you are building. compile
requires group, name, and version. These can either be broken out or specified using the short form "group:name:version". see Gradle Dependency Management Basics
compile
为您正在构建的项目指定外部依赖项。compile
需要组、名称和版本。这些可以使用短格式"group:name:version"来分解或指定。参见Gradle 依赖管理基础
The buildscript
block declares the dependencies of your gradle build itself while the normaldependencies block declares the dependencies of the project you are going to build
该buildscript
块声明了您的 gradle 构建本身的依赖项,而普通的dependencies 块声明了您将要构建的项目的依赖项