spring-boot gradle plugin can't be found

前端 未结 8 1234
醉话见心
醉话见心 2021-02-05 02:44

I have a separate gradle script that is just adding spring-boot plugin. It looks like this:

buildscript {
    repositories {
        mavenLocal()
        mavenCe         


        
相关标签:
8条回答
  • 2021-02-05 02:53

    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.

    0 讨论(0)
  • 2021-02-05 02:55

    could it be, that you don't have a @SpringBootApplication with a main(String[] main) on your classpath ??

    0 讨论(0)
  • 2021-02-05 02:56
    1. Add:

      buildscript {
          repositories {
              maven {
                  url "https://plugins.gradle.org/m2/"
              }
          }
          dependencies {
              classpath "org.springframework.boot:spring-boot-gradle-plugin:2.0.4.RELEASE"
          }}
      
    2. Change:

      apply plugin: 'spring-boot'
      

      to:

      apply plugin: "org.springframework.boot"
      
    0 讨论(0)
  • 2021-02-05 03:00

    As of now July first 2020, this is how I was able to configure it, and it worked! Hopefully, this can help anyone facing this problem. Note: Pay attention to the versions

    buildscript {
            repositories {
                mavenCentral()
            }
            dependencies {
                classpath('org.springframework.boot:spring-boot-gradle-plugin:2.2.8.RELEASE')
            }
        }
        
        plugins {
            id 'org.springframework.boot' version '2.2.8.RELEASE'
            id 'java'
        }
        
        group 'org.capfer'
        version '1.0-SNAPSHOT'
        
        sourceCompatibility = 1.8
        
        repositories {
            mavenCentral()
        }
        
        dependencies {
            testCompile group: 'junit', name: 'junit', version: '4.12'
            compile('org.springframework.boot:spring-boot-starter-web:2.2.8.RELEASE')
        }
    
    0 讨论(0)
  • 2021-02-05 03:03

    Starting from SpringBoot 1.4.0.RELEASE the plugin package has been slightly changed.

    apply plugin: org.springframework.boot.gradle.plugin.SpringBootPlugin
    
    0 讨论(0)
  • 2021-02-05 03:17

    This code works for me

     plugins{
    
      id 'org.springframework.boot' version '2.0.3.RELEASE'
    
     }
    
    0 讨论(0)
提交回复
热议问题