插件ID为春季启动在父母的build.gradle没有发现

插件ID为春季启动在父母的build.gradle没有发现

问题描述:

我有以下项目结构:插件ID为春季启动在父母的build.gradle没有发现

的Java/
   的build.gradle
    settings.gradle
   了projectA/
        build.gradle
    projectB/
       的build.gradle

当我把下面码,例如了projectA的的build.gradle,

buildscript { 
    repositories { 
     mavenCentral() 
    } 
    dependencies { 
     classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.6.RELEASE") 
    } 
} 

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

一切工作正常。

但是如果我把上面的代码Java的的build.gradle:

subprojects { 
    buildscript { 
     repositories { 
      mavenCentral() 
     } 
     dependencies { 
      classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.6.RELEASE") 
     } 
    } 

    apply plugin: 'java' 
    apply plugin: 'eclipse' 
    apply plugin: 'spring-boot' 
    ... 
} 

运行时的gradle干净的构建,它使报告如下错误:

Plugin with id 'spring-boot' not found.

任何人都遇到过这个问题?为什么?

我想出了一个解决方案,但不知道为什么。会花了一些时间在周末阅读文档...

变化多项目的build.gradle以下:

buildscript { 
    repositories { 
     mavenCentral() 
    } 

    dependencies { 
      classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.6.RELEASE") 
    } 
} 

subprojects { 
    apply plugin: 'java' 
    apply plugin: 'eclipse' 
    apply plugin: 'spring-boot' 
    ... 
} 

即移动buildscript出子项目