plugin with id 'org.springframework.boot' not found

buratino :

I would like to include the spring boot plugin to my project using gradle 5.2. Below is the current state of my build.gradle, followed by things I have tried to do. Currently, I am trying to use gradle 5's BOM support, but this is not a hard requirement. I just want to know how to solve the error

plugin with id 'org.springframework/boot' not found

UPDATE: Updated the structure below to better represent my use case.

build.gradle

apply from: 'boot.gradle'

boot.gradle

repositories {
    mavenCentral()
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'

dependencies {
    implementation platform('org.springframework.boot:spring-boot-dependencies:2.0.0.RELEASE')

    implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.0.0.RELEASE'
    implementation group: 'org.springframework.boot', name: 'spring-boot-starter-tomcat', version: '2.0.0.RELEASE'

    implementation group: 'org.springframework.boot', name: 'spring-boot-gradle-plugin', version: '2.0.0.RELEASE'
}

To recreate my error, you need only one more file in your project:

Application.java

@SpringBootApplication
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

I have attempted to implement the solution found here, which is based on

In external scripts (we call them script plugins), plugin IDs cannot be used. Instead, the fully qualified class name has to be used. This is a known bug.

and here which isn't working for me, even if I upgrade to use spring 2.0.5.

As well as various other similar solutions.

buratino :

This solution for my use case is based on Abdelghani's answer.

build.gradle

plugins {
    id 'org.springframework.boot' version '2.1.3.RELEASE'
    id 'java'
}

apply from: 'boot.gradle'

boot.gradle

repositories {
    mavenCentral()
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'

dependencies {
    implementation platform('org.springframework.boot:spring-boot-dependencies:2.0.0.RELEASE')

    implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.0.0.RELEASE'
    implementation group: 'org.springframework.boot', name: 'spring-boot-starter-tomcat', version: '2.0.0.RELEASE'

    implementation group: 'org.springframework.boot', name: 'spring-boot-gradle-plugin', version: '2.0.0.RELEASE'
}

In short, the buildscript needed to have 'org.springframework.boot' available as a plugin for apply plugin: 'org.springframework.boot' to work elsewhere.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=146130&siteId=1