springCloud集成elasticsearch报错Cannot resolve org.springframework.boot:spring-boot-starter-data-elastic

写在前面:

使用springboot (2.5.4版本)集成elasticsearch (7.6.1)时,导入依赖

<dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-data-elasticsearchartifactId>
dependency>

是可以正常导入的

问题

在使用springcloud 集成elasticsearch时使用同样的依赖就会报错
报错内容:

Cannot resolve org.springframework.boot:spring-boot-starter-data-elasticsearch:unknown

解决办法:
父工程使用:

<dependency>
                <groupId>org.springframework.bootgroupId>
                <artifactId>spring-data-elasticsearchartifactId>
dependency>

子工程使用:

<dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-data-elasticsearchartifactId>
dependency>

这样就不会报错了,版本根据自己的需要选择吧

你可能感兴趣的:(spring,boot,elasticsearch,spring,cloud)