【发布时间】:2021-06-02 18:42:22
【问题描述】:
当我使用spring boot 2.4.0时如何降级elasticsearch版本? 我想使用elasticsearch 6.6.0版本,但是在使用spring boot 2.4.0版本时,即使在依赖中指定了6.6.0,也会自动使用7.9.4版本的依赖。如何将elasticsearch版本降级到6.6.0 有这个吗?
【问题讨论】:
标签: spring spring-boot elasticsearch
当我使用spring boot 2.4.0时如何降级elasticsearch版本? 我想使用elasticsearch 6.6.0版本,但是在使用spring boot 2.4.0版本时,即使在依赖中指定了6.6.0,也会自动使用7.9.4版本的依赖。如何将elasticsearch版本降级到6.6.0 有这个吗?
【问题讨论】:
标签: spring spring-boot elasticsearch
导入时的排除在 maven 中不起作用!!
<dependencyManagement>
<dependencies>
<!-- define all downgraded version of elastic search dependencies here. I mean ALL -->
<dependency>
<groupId>my-group</groupId>
<artifactId>my-group-project-bom</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<type>pom</type>
<version>${spring-boot.version}</version>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
【讨论】:
我通过将此代码添加到 gradle.build 来解决这个问题
buildscript {
...
ext {
...
set('elasticsearch.version', '6.6.0')
}
通过使用此代码,我可以将 elasticsearch 的版本覆盖为 6.6.0,即使我使用的是 Spring Boot 版本 2.4.0。
【讨论】: