“编译组”和“编译”有什么区别?另一种定义依赖关系的方法?
例如:
compile group: 'org.slf4j', name: 'slf4j-jcl', version: '1.7.21'
而且我认为这也会奏效:
compile("org.slf4j:slf4j-jcl:1.7.21")
为什么我再次声明mavenCentral()
并在buildscript块中有另一个依赖块?
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.0.RELEASE")
}
}
从我的角度来看,当你编译一些东西时,它会在你的classPath中?
compile
为您正在构建的项目指定外部依赖项。 compile
需要组,名称和版本。这些可以使用简短形式“group:name:version”来分解或指定。见Gradle Dependency Management Basics
buildscript
块声明了gradle构建本身的依赖关系,而普通依赖关系块声明了要构建的项目的依赖关系