I have a separate gradle script that is just adding spring-boot plugin. It looks like this:
buildscript { repositories { mavenLocal() mavenCentral() maven { url 'http://repo.spring.io/libs-release' } } dependencies { classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.1.8.RELEASE' } } apply plugin: 'spring-boot'
Then, in another project, it is referenced like this:
apply from: '../../food-orders-online-main/spring-boot.gradle'
When I run build task I'm getting the following error:
A problem occurred evaluating script. > Failed to apply plugin [id 'spring-boot'] > Plugin with id 'spring-boot' not found.
Someone knows what I'm doing wrong?
The Spring Boot Gradle Plugin provides Spring Boot support in Gradle. It allows you to package executable jar or war archives, run Spring Boot applications, and use the dependency management provided by spring-boot-dependencies . Spring Boot's Gradle plugin requires Gradle 6.8, 6.9, or 7.
Applying a plugin by plugin id is not supported in script plugins. You must use the plugin's fully qualified class name.
apply plugin: org.springframework.boot.gradle.plugin.SpringBootPlugin
See this thread for more information.
UPDATE: Updating plugin class name.
These are the Plugins that I am using on spring boot 2.0.1
apply plugin: 'java' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management'
My complete vanilla gradle file here (Spring boot 2.0.5)
buildscript { ext { springBootVersion = '2.0.5.RELEASE' } repositories { mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") } } apply plugin: 'java' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' group = 'com.example' version = '0.0.1-SNAPSHOT' sourceCompatibility = 1.8 repositories { mavenCentral() } dependencies { compile('org.springframework.boot:spring-boot-starter') testCompile('org.springframework.boot:spring-boot-starter-test') }
OR
there is an even better option, go to the spring starter (spring boot template generating tool) start.spring.io And generate a template project from there, and build step-by-step from there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With