10
“compile group”和“compile”之间有什么区别?另一种定义依赖关系的方法是?build.gradle:编译组vs编译,构建脚本,类路径
例:
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'的'两个版本是同义的,准确的行为一样。 'dependencies'块不应该*需要*在'buildscript'块中。 – Whymarrh
在'buildscript'块中,您指定了它自己的gradle构建脚本的依赖关系(它们在编译build.gradle文件时使用)。这对于何时需要用于构建的库但应用程序不需要它很有用。例如,您可能想要使用ssh库进行构建,但您的应用程序不需要它。 – Aarjav