首页 > 解决方案 > Gradle 将编译 spring-boot-starter-web 更改为 implementation 导致错误:包 org.springframework.http 不存在

问题描述

我目前正在将项目从使用编译转换为使用 Gradle 5.4.1 的实现。

我遇到了一个问题,使用以下方法可以正常工作:

compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.2.2.RELEASE'

如果以下情况没有:

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

使用实现会导致出现以下错误:

/Path/To/File/AFileName.java error: package org.springframework.http does not exist
import org.springframework.http.HttpStatus;
                               ^

我在这两种情况下都特别指定了发布版本 2.2.2,因此它不应该通过更改 HttpStatus 的类位置来获取更新的版本。

有谁知道可能导致这种破坏行为的原因是什么?

标签: javaspringspring-bootgradle

解决方案


推荐阅读