最近在接触一个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'
}