gpt4 book ai didi

java - 当我们已经使用 id "io.spring.dependency-management"插件时,我们还需要 "org.springframework.boot"gradle 插件吗

转载 作者:行者123 更新时间:2023-12-02 01:20:54 28 4
gpt4 key购买 nike

当 spring-boot 插件添加到 Gradle 项目时会发生什么?为什么我们还需要显式包含 spring.dependency-management 插件?

plugins {
id "org.springframework.boot" version "2.1.5.RELEASE"
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
}

最佳答案

自 Gradle 5+ supports BOM文件,您不再需要依赖管理插件。仍然需要 Spring Boot 插件来提供 bootJarbootRun 等任务。这是一个应该可以工作的最小 build.gradle:

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'
}
}

关于java - 当我们已经使用 id "io.spring.dependency-management"插件时,我们还需要 "org.springframework.boot"gradle 插件吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57717042/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com