Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do we need "io.spring.dependency-management" gradle plugin when already using id "org.springframework.boot" plugin

What happens when spring-boot plugin is added to Gradle project? Why do we need to explicitly include spring.dependency-management plugin also.?

plugins {
    id "org.springframework.boot" version "2.1.5.RELEASE"
    id 'io.spring.dependency-management' version '1.0.8.RELEASE'
}
like image 968
arjdev Avatar asked Aug 29 '19 20:08

arjdev


1 Answers

Since Gradle 5+ supports BOM files, you don't need the dependency-management plugin anymore. The spring boot plugin is still needed to provide tasks such as bootJar and bootRun. Here's a minimal build.gradle that should work:

buildscript {
    ext {
        springBootVersion = '2.2.4.RELEASE'
    }
}

repositories {
    mavenCentral()
}

plugins {
    id 'java'
    id 'org.springframework.boot' version "${springBootVersion}"
}

dependencies {
    implementation platform("org.springframework.boot:spring-boot-dependencies:${springBootVersion}")
    implementation 'org.springframework.boot:spring-boot-starter'
    implementation 'org.springframework.boot:spring-boot-starter-webflux'
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
}
like image 61
josephyi Avatar answered Sep 27 '22 20:09

josephyi