I've been trying to run my ElasticSearch plugin unit tests (extending the `ESTestcase` class) using the following command `./gradlew`, but unfortunately I keep getting the following exception:
```
Gradle Test Executor 1 finished executing tests.

org.elasticsearch.index.query.SimilaritySearchQueryBuilderTests > classMethod FAILED
    java.lang.RuntimeException: found jar hell in test classpath

        Caused by:
        java.nio.file.NoSuchFileException: /Developer/sds/image-search/build/resources/test
Exception in thread "Thread-4" java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.test.ESTestCase
        at java.lang.Thread.run(Thread.java:745)
        Suppressed: java.lang.IllegalStateException: No context information for thread: Thread[id=14, name=Thread-4, state=RUNNABLE, group=TGRP-SimilaritySearchQueryBuilderTests]. Is this thread running under a class com.carrotsearch.randomizedtesting.RandomizedRunner runner context? Add @RunWith(class com.carrotsearch.randomizedtesting.RandomizedRunner.class) to your test class. Make sure your code accesses random contexts within @BeforeClass and @AfterClass boundary (for example, static test class initializers are not permitted to access random contexts).
                at com.carrotsearch.randomizedtesting.RandomizedContext.context(RandomizedContext.java:248)
                at com.carrotsearch.randomizedtesting.RandomizedContext.current(RandomizedContext.java:134)
                at com.carrotsearch.randomizedtesting.RandomizedRunner.augmentStackTrace(RandomizedRunner.java:1848)
                at com.carrotsearch.randomizedtesting.RunnerThreadGroup.uncaughtException(RunnerThreadGroup.java:20)
                at java.lang.Thread.dispatchUncaughtException(Thread.java:1952)

```
Interestedly, if I run the unit tests from the IDEA, the tests run without any problems, i.e. no jar hell related exception occurs. Following advice from the previous related discussions, I've excluded `hamcrest-core` from the `junit` dependency, but unfortunately none helper. Here you may find the `build.gradle` file of mine.

```
group 'group'
version '1.0-SNAPSHOT'

apply plugin: 'java'

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    compileOnly group: 'org.elasticsearch', name: 'elasticsearch', version: '5.3.2'

    testCompile group: 'org.apache.lucene', name: 'lucene-test-framework', version: '6.4.2'
    testCompile group: 'org.elasticsearch.test', name: 'framework', version: '5.3.2'
    testCompile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.10.0'
    testCompile group: 'com.vividsolutions', name: 'jts', version: '1.13'
    testCompile group: 'org.locationtech.spatial4j', name: 'spatial4j', version: '0.6'
    testCompile (group: 'junit', name: 'junit', version: '4.12') {
        exclude module : 'hamcrest'
        exclude module : 'hamcrest-core'
    }
}

test {
    systemProperty 'tests.security.manager', System.getProperty('tests.security.manager')
}
```
Could please someone provide a hint onto why this issue happens when running the tests using Gradle?

---