小编Maa*_*985的帖子

Gradle 找不到 org.ehcache:ehcache:。升级到 Spring Boot 3.0.x 后

我目前正在将 Spring Boot Gradle 项目从 2.7.x 升级到 3.0.x。在此项目中,我们将 Ehcache 库声明为 API 依赖项:

api 'org.ehcache:ehcache'
Run Code Online (Sandbox Code Playgroud)

阅读迁移指南后,我将其更改为以下内容:

api('org.ehcache:ehcache') {
    capabilities {
        requireCapability('org.ehcache:ehcache-jakarta')
    }
}
Run Code Online (Sandbox Code Playgroud)

然而运行后./gradlew build,Gradle 未能解决依赖关系:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not find org.ehcache:ehcache:.
     Required by:
         project :
Run Code Online (Sandbox Code Playgroud)

我尝试了以下可能的解决方法:

api 'org.ehcache:ehcache-jakarta'
Run Code Online (Sandbox Code Playgroud)

不起作用。

api 'org.ehcache:ehcache:jakarta'
Run Code Online (Sandbox Code Playgroud)

不起作用。

但是,在声明版本时它确实有效:

api 'org.ehcache:ehcache:3.10.8:jakarta'
Run Code Online (Sandbox Code Playgroud)

但如果这是由 Spring Boot 管理的,为什么要声明一个版本呢?

Spring Boot 版本: 3.0.4 …

gradle spring-boot ehcache-3

2
推荐指数
1
解决办法
1079
查看次数

标签 统计

ehcache-3 ×1

gradle ×1

spring-boot ×1