I was trying to include buildscript from an external gradle script but constantly getting some error. Then I found this forum subject, but it was discussed in 2012.
https://discuss.gradle.org/t/how-do-i-include-buildscript-block-from-external-gradle-script/7016
Any changes since then?
Here is my code:
myPlugin.gradle
buildscript {
ext {
springBootVersion = '1.3.5.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'spring-boot'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
/*
compile('org.springframework.boot:spring-boot-starter')
compile('org.springframework.boot:spring-boot-starter-web')
compile("org.springframework.boot:spring-boot-starter-actuator")
testCompile('org.springframework.boot:spring-boot-starter-test')
*/
}
}
build.gradle
apply from: "../myProject/myPlugin.gradle"
Below error is thrown:
> Plugin with id 'spring-boot' not found.
In order to make it work, I change the build.gradle to this code:
buildscript {
ext {
springBootVersion = '1.3.5.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply from: "../myProject/myPlugin.gradle"
Which works fine.
Thanks...