gpt4 book ai didi

spring-boot - 从 Spring Boot 1.5.10 迁移到 2.0.0 时无法解决依赖关系

转载 作者:行者123 更新时间:2023-12-03 14:39:51 28 4
gpt4 key购买 nike

因此,我将我的基本应用程序从 Spring Boot 1.5.10 迁移到 2.0.0。我正在使用 Gradle,在迁移之前,我总是排除编译依赖项的工件的版本号。迁移后,gradle build 任务开始抛出这样的错误:

BUILD FAILED in 0s
2 actionable tasks: 1 executed, 1 up-to-date

During the build, one or more dependencies that were declared without a version failed to resolve:
org.springframework.boot:spring-boot-starter-data-rest:
org.springframework.boot:spring-boot-starter-web:
org.springframework.boot:spring-boot-starter-data-jpa:

Did you forget to apply the io.spring.dependency-management plugin to the llutrackr project?

我的 build.gradle (我排除了不相关的部分):
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.0.RELEASE")
}
}

dependencies {
compile("org.springframework.boot:spring-boot-starter-data-rest")
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-web')
}

我在对应的依赖中加上版本号后,问题就解决了。为什么要使用 gradle 构建 Spring Boot 2.0 项目需要进行此更改?甚至 Spring 指南也不包含工件版本号。 An example

最佳答案

尝试将以下内容添加到您的 build.gradle 文件中

apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

https://docs.spring.io/spring-boot/docs/2.0.0.BUILD-SNAPSHOT/gradle-plugin/reference/html/

关于spring-boot - 从 Spring Boot 1.5.10 迁移到 2.0.0 时无法解决依赖关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49084317/

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