目的,如何强行替换spring boot parent中的依赖jar!!!由于我们spring boot版本是
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.4.RELEASE</version>
</parent>
引入的spring-boot-starter-data-elasticsearch版本是2.0.4.RELEASE,该版本是elasticsearch-5.6.0版本,然而部署的elasticsearch是6.8.3版本导致连不上。(我强行spring-boot-starter-data-elasticsearch版本缓存2.2.1.RELEASE,他的elasticsearch是6.8.4,但是还是5.6.0)
这里就不使用该包,我们使用spring-boot-starter-data-elasticsearch版本2.2.1.RELEASE中的配置文件。
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>3.2.1.RELEASE</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>jcl-over-slf4j</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>log4j-core</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
</exclusions>
</dependency>
//切记
<properties>
<elasticsearch>6.8.4</elasticsearch>
<elasticsearch.version>6.8.4</elasticsearch.version>
</properties>
这里一定要加,覆盖配置文件版本,不然依然还是5.6.0
这里 和 elasticsearch 没有任何关系,只是说明如何强制替换jar 有问题请查看其它文章