我使用 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
上述错误意味着我还需要应用 spring-bootmain-module
并将所有 buildScript 依赖项都包含在 main-module build.gradle 中的 spring repos 中。
main-module
必须声明它最不关心的插件和依赖项似乎是错误的。
Gradle 版本:2.10 Spring-boot 版本:1.3.2.RELEASE