Plugin with id spring-boot not found in parent build.gradle

I have below the project structure:

Java /
build.gradle
settings.gradle
PROJECTA /
build.gradle
projectB /
build.gradle

When I put below codes, for example, 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' ... 

everything is working fine.

But if I put the above code in 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' ... } 

When running gradle clean build, it reports the error below:

Plugin with id 'spring-boot' not found.

Has anyone encountered this problem before? And why?

+5
source share
1 answer

I understood the solution, but I don’t know why. After spending some time reading the documents on the weekend ...

Modify multi-project build.gradle below:

 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' ... } 

i.e. move buildscript from subprojects

+7
source

Source: https://habr.com/ru/post/1235343/


All Articles