最近在接觸一個gradle構建方式的老項目時,編譯項目時出現如標題所示錯誤
然後在網上找了一堆答案也沒有找到正確的解決辦法,後面仔細研究了一下gradle.build配置文件,
buildscript {
......
}
apply plugin: 'java'
apply plugin: 'application'
jar {
baseName = 'xxx'
version = '0.1.0'
}
dependencies {
compile "xxx:xxx:xxx"
.......
}
task wrapper(type: Wrapper) {
gradleVersion = '1.11'
}
發現模塊中少了repositories配置項,然後在buildscript{}塊中和頂級配置中分別配置了repositories配置項,問題解決.
buildscript {
repositories {
mavenCentral()
}
apply plugin: 'java'
apply plugin: 'application'
repositories {
mavenCentral()
}
jar {
baseName = 'xxx'
version = '0.1.0'
}
dependencies {
compile "xxx:xxx:xxx"
}
task wrapper(type: Wrapper) {
gradleVersion = '1.11'
}