Gradle父项目不使用子存储库?

时间:2016-06-01 13:05:09

标签: java gradle

这就是我解释它的方式。我有一个包含2个模块的多项目构建:编解码器和内容。当我尝试构建项目时,它说它无法找到存储库。但是在构建单个模块时,没有错误。此外,evaluationDependsOn(':codec')似乎没有帮助。

Could not resolve all dependencies for configuration ':compileClasspath'.
> Cannot resolve external dependency commons-codec:commons-codec:1.5 because no repositories are defined.
  Required by:
      :multiproject-unified:unspecified > multiproject-unified:codec:unspecified

parent build.gradle:

apply plugin: 'java'

dependencies {
    compile project(':codec')
    compile project(':content')
}

settings.gradle

include 'codec',
        'content'

:编解码器build.gradle

apply plugin: 'java'

repositories {
    mavenCentral()
}

dependencies {
    compile 'commons-codec:commons-codec:1.5'
}

:内容build.gradle

apply plugin: 'java'

repositories {
    mavenCentral()
}

1 个答案:

答案 0 :(得分:0)

尝试在父级中声明整个项目的存储库:

allprojects {
  apply plugin: 'java'
  repositories {
    mavenCentral()
  }
}