I am trying to build a new up to date Spring Boot project but cannot find a way to switch Spring Data release train. We are using Elasticsearch with version 6.8 so I cannot just go with default dependencies provided by Spring Boot.
Spring Data Elasticsearch reference page tells that to use version 6.8 I need to use Moore release train https://docs.spring.io/spring-data/elasticsearch/docs/current/reference/html/#preface.versions.
I have seen documentation for Maven https://docs.spring.io/spring-boot/docs/2.1.10.RELEASE/reference/html/using-boot-build-systems.html#using-boot-maven-without-a-parent but same documentation for Gradle is lacking Release Train switch example https://docs.spring.io/spring-boot/docs/2.1.10.RELEASE/gradle-plugin/reference/html/#managing-dependencies-using-in-isolation.
In short I have the following pieces in my build.gradle:
plugins {
id 'org.springframework.boot' version '2.3.5.RELEASE'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'
}
dependencyManagement {
imports {
mavenBom 'org.springframework.data:spring-data-releasetrain:Moore-SR11'
}
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-elasticsearch'
}
Switching BOM in dependencyManagement
section helps to switch spring-data-elasticsearch
version from 4.0.5.RELEASE
to 3.2.11.RELEASE
but the version of elasticsearch
is still taken as 7.6.2
from somewhere (gradle dependencies
output):
+--- org.springframework.boot:spring-boot-starter-data-elasticsearch -> 2.3.5.RELEASE
| +--- org.springframework.boot:spring-boot-starter:2.3.5.RELEASE (*)
| \--- org.springframework.data:spring-data-elasticsearch:4.0.5.RELEASE -> 3.2.11.RELEASE
| +--- org.springframework:spring-context:5.2.10.RELEASE (*)
| +--- org.springframework:spring-tx:5.2.10.RELEASE (*)
| +--- org.springframework.data:spring-data-commons:2.2.11.RELEASE
| | +--- org.springframework:spring-core:5.2.10.RELEASE (*)
| | +--- org.springframework:spring-beans:5.2.10.RELEASE (*)
| | \--- org.slf4j:slf4j-api:1.7.26 -> 1.7.30
| +--- joda-time:joda-time:2.10.8
| +--- org.elasticsearch.plugin:transport-netty4-client:6.8.13 -> 7.6.2
| | +--- io.netty:netty-buffer:4.1.43.Final -> 4.1.53.Final
| | +--- io.netty:netty-codec:4.1.43.Final -> 4.1.53.Final
| | +--- io.netty:netty-codec-http:4.1.43.Final -> 4.1.53.Final
| | +--- io.netty:netty-common:4.1.43.Final -> 4.1.53.Final
| | +--- io.netty:netty-handler:4.1.43.Final -> 4.1.53.Final
| | +--- io.netty:netty-resolver:4.1.43.Final -> 4.1.53.Final
| | \--- io.netty:netty-transport:4.1.43.Final -> 4.1.53.Final
| +--- org.elasticsearch.client:elasticsearch-rest-high-level-client:6.8.13 -> 7.6.2
| | +--- org.elasticsearch:elasticsearch:7.6.2
Is there a good example available or what am I missing here?
UPDATE: I found why I have version 7.6.2 taken for Elasticsearch. It is coming from spring-boot-dependencies
project https://github.com/spring-projects/spring-boot/blob/v2.3.5.RELEASE/spring-boot-project/spring-boot-dependencies/build.gradle#L274.
Still looking for a way to override it.