Skip to content

Commit 269faa2

Browse files
committed
[Example Builds] Fix Jarhell in example build due to version conflict
In test framework we expose org.hamcrest:hamcrest. Transitively junit and the randomized runner expose hamcrest-core transitive dependencies. This makes jarHell task fail as those jars share common class files. We exclude hamcrest core now explicitly as transitive dependency in the generated pom for test framework as we already include a superset of this by having a direct dependency on hamcrest which includes hamcrest-core
1 parent fe74aa4 commit 269faa2

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

test/framework/build.gradle

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@ apply plugin: 'elasticsearch.build'
1111
apply plugin: 'elasticsearch.publish'
1212

1313
configurations {
14-
// we do not want to expose a version conflict in transitive dependencies by
15-
// bringing in different versions of hamcrest and hamcrest-core.
16-
// Therefore we exclude transitive deps on hamcrest-core here as we have a direct
17-
// dependency on a newer version.
18-
runtimeElements {
19-
exclude group: 'org.hamcrest', module: 'hamcrest-core'
20-
}
14+
2115
}
2216
dependencies {
2317
api project(":client:rest")
@@ -27,12 +21,17 @@ dependencies {
2721
api project(":libs:cli")
2822
api project(":libs:entitlement:bridge")
2923
api "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}"
24+
25+
// we do not want to expose a version conflict in transitive dependencies by
26+
// bringing in different versions of hamcrest and hamcrest-core.
27+
// Therefore we exclude transitive deps on hamcrest-core here as we have a direct
28+
// dependency on a newer version.
29+
api "org.hamcrest:hamcrest:${versions.hamcrest}"
3030
api("junit:junit:${versions.junit}") {
31-
// exclude group: 'org.hamcrest'
31+
exclude group: 'org.hamcrest', module: 'hamcrest-core'
3232
}
33-
api "org.hamcrest:hamcrest:${versions.hamcrest}"
3433
api("org.apache.lucene:lucene-test-framework:${versions.lucene}") {
35-
// exclude group: 'org.hamcrest'
34+
exclude group: 'org.hamcrest', module: 'hamcrest-core'
3635
}
3736
api "org.apache.lucene:lucene-codecs:${versions.lucene}"
3837
api "commons-logging:commons-logging:${versions.commonslogging}"

0 commit comments

Comments
 (0)