Gradle multi Project - 应用插件:spring-boot问题

时间:2016-06-08 16:56:11

标签: gradle spring-boot multi-module

我开始研究Gradle multi project,我有像

这样的项目结构
Parent
  build.gradle
  Project A
     build.gradle
  Project B
     build.gradle

我正在尝试使用spring-boot,因为我在Parent Gradle中添加了apply plugin: 'spring-boot'但是我得到Plugin with id 'spring-boot' not found.我将应用插件放在Project A中并在父级中删除但仍然同样的问题。如果我将Project AParent项目分开并作为新的单个项目运行,它可以正常工作,但在多项目的情况下无法正常工作。

如果我从整个项目中删除apply plugin: 'spring-boot',则会Could not find method compile() for arguments [org.springframework.boot:spring-boot-starter-web] on root project 'Project A'.感谢您对此的帮助。感谢。

EDITED

在此处添加了我的Gradle文件

父项目

group 'com.mydomain'
version '1.0-SNAPSHOT'   

buildscript {
repositories{
    mavenCentral()

}
dependencies {
    classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.2.6.RELEASE'
}
}

subprojects {

apply plugin: 'java'
apply plugin: 'spring-boot'

repositories {
    mavenCentral()
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.11'
    compile("org.springframework.boot:spring-boot-starter-web")
    testCompile('org.springframework.boot:spring-boot-starter-test')
}
}
项目A.
group 'com.mydomain'
version '1.0-SNAPSHOT'
// I added dependencies and apply plug-in here but got same issue
项目B.
group 'com.mydomain'
version '1.0-SNAPSHOT'

Parent Settings.gradle

rootProject.name = 'Parent'
include 'Project A'
include 'Project B'

0 个答案:

没有答案