From cab6e78b472e10b8c1e2957a6aa4da08a3524dae Mon Sep 17 00:00:00 2001 From: Rene Groeschke Date: Tue, 16 Sep 2025 09:58:08 +0200 Subject: [PATCH] [Gradle] Simple fix the dependencies in test-framework (#134746) The transitive dependencies in test-framework inheritely have a version conflict that results in a jarHell in our example builds. We fix that for now by excluding hamcrest-core for now as it has been in the past before we changed transitive dependency handling. --- test/framework/build.gradle | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/test/framework/build.gradle b/test/framework/build.gradle index 78e62f9eb1f5a..9c6e2b1ffe083 100644 --- a/test/framework/build.gradle +++ b/test/framework/build.gradle @@ -11,6 +11,15 @@ import org.elasticsearch.gradle.internal.info.BuildParams; apply plugin: 'elasticsearch.build' apply plugin: 'elasticsearch.publish' +configurations { + // we do not want to expose a version conflict in transitive dependencies by + // bringing in different versions of hamcrest and hamcrest-core. + // Therefore we exclude transitive deps on hamcrest-core here as we have a direct + // dependency on a newer version. + runtimeElements { + exclude group: 'org.hamcrest', module: 'hamcrest-core' + } +} dependencies { api project(":client:rest") api project(':modules:transport-netty4') @@ -19,9 +28,13 @@ dependencies { api project(":libs:cli") api project(":libs:entitlement:bridge") api "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}" - api "junit:junit:${versions.junit}" + api("junit:junit:${versions.junit}") { +// exclude group: 'org.hamcrest' + } api "org.hamcrest:hamcrest:${versions.hamcrest}" - api "org.apache.lucene:lucene-test-framework:${versions.lucene}" + api("org.apache.lucene:lucene-test-framework:${versions.lucene}") { +// exclude group: 'org.hamcrest' + } api "org.apache.lucene:lucene-codecs:${versions.lucene}" api "commons-logging:commons-logging:${versions.commonslogging}" api "commons-codec:commons-codec:${versions.commonscodec}"