我使用gradle,并且有一个应用了spring boot插件的模块/项目 . 让我们说一个项目 sub-module ,我有 apply plugin: "spring-boot" .

现在从另一个模块/项目我将testCompile依赖项添加到子模块 . 从另一个项目 main-module 说,我添加了以下依赖项

dependencies {
   testCompile project(":sub-module")
}

但是当我测试编译 main-module 时,我得到以下错误,

* What went wrong:
Could not resolve all dependencies for configuration ':main-module:testCompile'.
> Could not find org.springframework.boot:spring-boot-starter-logging:.
  Searched in the following locations:
      https://jcenter.bintray.com/org/springframework/boot/spring-boot-starter-logging//spring-boot-starter-logging-.pom
      https://jcenter.bintray.com/org/springframework/boot/spring-boot-starter-logging//spring-boot-starter-logging-.jar
  Required by:
      com.xx.xx-main-module:1.0-SNAPSHOT > com.xx.xx:sub-module:1.0-SNAPSHOT
> Could not find org.springframework.boot:spring-boot-starter-data-solr:.
  Searched in the following locations:
      https://jcenter.bintray.com/org/springframework/boot/spring-boot-starter-data-solr//spring-boot-starter-data-solr-.pom
      https://jcenter.bintray.com/org/springframework/boot/spring-boot-starter-data-solr//spring-boot-starter-data-solr-.jar
  Required by:
      com.xx.xx:main-module:1.0-SNAPSHOT > com.xx.xx:sub-module:1.0-SNAPSHOT

上面的错误意味着我需要在 main-module 中应用spring-boot,并且在main-module build.gradle中具有spring repos的所有buildScript依赖项 .

似乎错误的是 main-module 必须声明它最不受打扰的插件和依赖项 .

Gradle版本:2.10 Spring-boot版本:1.3.2.RELEASE