Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

spring-boot gradle plugin can't be found

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?

like image 604
Rade Milovic Avatar asked Oct 26 '14 20:10

Rade Milovic


People also ask

What is spring boot gradle plugin?

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.


2 Answers

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.

like image 69
Mark Vieira Avatar answered Oct 04 '22 11:10

Mark Vieira


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.

like image 38
so-random-dude Avatar answered Oct 04 '22 12:10

so-random-dude