【发布时间】:2015-03-08 15:22:40
【问题描述】:
我关注了这个tutorial。这运行良好。
我想用一个包含这个 spring 应用程序的项目创建一个多项目构建。所以我将此项目添加到此多项目构建的名为web 的子文件夹中,添加了一个 settings.gradle 文件:
include 'web'
还有一个 build.gradle 文件:
apply plugin: 'application'
mainClassName = "hello.Application"
jar {
baseName = 'VoPro'
}
dependencies {
compile project(':web')
}
但是,当我运行 $ gradle build 时,我得到了错误:
Could not resolve all dependencies for configuration ':runtime'.
> Cannot resolve external dependency org.springframework.boot:spring-boot-starter-web: because no repositories are defined.
Required by:
:test:unspecified > test:web:unspecified
为什么 gradle 找不到任何仓库?
编辑:web 子项目包含以下 build.gradle 文件(如教程中所示):
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.2.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
jar {
baseName = 'gs-rest-service'
version = '0.1.0'
}
repositories {
mavenCentral()
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
testCompile("junit:junit")
}
task wrapper(type: Wrapper) {
gradleVersion = '1.11'
}
【问题讨论】:
-
试试
include ':web' -
@BorisBera 你的意思是在设置文件中?刚试了一下,好像都还好。
-
我注意到我链接了错误的教程,现在应该修复了
标签: java spring gradle multi-project