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