allegro / embedded-elasticsearch

Tool that ease up creation of integration tests with Elasticsearch
Apache License 2.0
269 stars 81 forks source link

Exception in ElasticDownloader#getDownloadDirectory() java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.getFile(Ljava/io/File;[Ljava/lang/String;)Ljava/io/File; #89

Open neerajjain92 opened 5 years ago

neerajjain92 commented 5 years ago

I added specified pom in the ReadMe as follows

        <!-- Embedded ElasticSearch For Integration Tests -->
        <dependency>
            <groupId>pl.allegro.tech</groupId>
            <artifactId>embedded-elasticsearch</artifactId>
            <version>2.7.0</version>
            <scope>test</scope>
        </dependency>

And when i ran my integration test, it started failing with the following exception trace :

java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.getFile(Ljava/io/File;[Ljava/lang/String;)Ljava/io/File;

    at pl.allegro.tech.embeddedelasticsearch.ElasticDownloader.getDownloadDirectory(ElasticDownloader.java:40)
    at pl.allegro.tech.embeddedelasticsearch.ElasticDownloader.prepareDirectories(ElasticDownloader.java:36)
    at pl.allegro.tech.embeddedelasticsearch.ElasticDownloader.download(ElasticDownloader.java:31)
    at pl.allegro.tech.embeddedelasticsearch.ElasticSearchInstaller.install(ElasticSearchInstaller.java:50)
    at pl.allegro.tech.embeddedelasticsearch.EmbeddedElastic.installElastic(EmbeddedElastic.java:66)
    at pl.allegro.tech.embeddedelasticsearch.EmbeddedElastic.start(EmbeddedElastic.java:56)
    at com.apple.ist.b2bcrm.partnerportal.service.impl.StoryServiceImplIntegrationTest.setup(StoryServiceImplIntegrationTest.java:111)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Solution for this can just use the latest apacahe-commons-io dependency.

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.6</version>
        </dependency>

Adding this dependency solved my issue, My question is, is this the recommended way to solve this problem.