【问题标题】:How to downgrade elasticsearch version When i use spring boot 2.4.0?当我使用spring boot 2.4.0时如何降级elasticsearch版本?
【发布时间】: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


    【解决方案1】:

    导入时的排除在 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>
    
    

    https://stackoverflow.com/a/63099817/8646703

    【讨论】:

    • 对不起,我用的是gradle,如何定义gradle?
    【解决方案2】:

    我通过将此代码添加到 gradle.build 来解决这个问题

    buildscript {
        ...
        ext {
            ...
            set('elasticsearch.version', '6.6.0')
        }
    

    通过使用此代码,我可以将 elasticsearch 的版本覆盖为 6.6.0,即使我使用的是 Spring Boot 版本 2.4.0。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-03-08
      • 2023-03-20
      • 2021-03-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-22
      • 2021-10-08
      相关资源
      最近更新 更多