运行Elasticsearch集成测试时Maven依赖项出错

时间:2016-04-18 14:15:55

标签: java maven elasticsearch

我正在尝试为Elasticsearch 1.7.0版运行Elasticsearch Integration测试。

我从Elasticsearch website复制了所需的依赖项。 它没有提供依赖版本,因此我查找了Elasticsearch 1.7.0版本发布时发布的相关依赖版本。

当我尝试运行扩展ElasticsearchIntegrationTest的测试时,我收到错误:

  

java.lang.NoClassDefFoundError:org / apache / lucene / search / ComplexExplanation       在org.apache.lucene.util.AbstractRandomizedTest。(AbstractRandomizedTest.java:155)       at java.lang.Class.forName0(Native Method)       在java.lang.Class.forName(Class.java:274)       在com.carrotsearch.randomizedtesting.RandomizedRunner $ 1.run(RandomizedRunner.java:573)

我已经尝试过使用每个依赖项的各种不同版本,每次我在Apache Lucene的某个类中找到一个类找不到错误(每次都不同),我还在pom.xml中包含了apache lucene依赖项但是它似乎没有改变任何东西。

这是我的pox.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>Project</groupId>
    <artifactId>Project</artifactId>
    <packaging>jar</packaging>
    <version>0.1.0</version>
    <name>Project</name>

<properties>
    <nd4j.version>0.4-rc3.8</nd4j.version>
    <dl4j.version>0.4-rc3.8</dl4j.version>
    <canova.version>0.0.0.14</canova.version>
    <jackson.version>2.5.1</jackson.version>
    <jdk.version>1.7</jdk.version>
    <randomizedtesting-runner.version>2.1.15</randomizedtesting-runner.version>
    <lucene.version>5.3.0</lucene.version>
    <elasticsearch.version>1.7.1</elasticsearch.version>
</properties>
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.nd4j</groupId>
            <artifactId>nd4j-x86</artifactId>
            <version>${nd4j.version}</version>
        </dependency>
    </dependencies>
</dependencyManagement>
<dependencies>
    <dependency>
        <groupId>org.jsoup</groupId>
        <artifactId>jsoup</artifactId>
        <version>1.8.3</version>
    </dependency>
    <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <version>1.7.1</version>
    </dependency>
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20151123</version>
    </dependency>
    <dependency>
        <groupId>com.yammer.dropwizard</groupId>
        <artifactId>dropwizard-core</artifactId>
        <version>0.6.2</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-servlets</artifactId>
        <version>8.1.10.v20130312</version>
    </dependency>
    <dependency>
        <groupId>org.nd4j</groupId>
        <artifactId>nd4j-x86</artifactId>
        <version>${nd4j.version}</version>
    </dependency>
    <dependency>
        <artifactId>canova-nd4j-image</artifactId>
        <groupId>org.nd4j</groupId>
        <version>${canova.version}</version>
    </dependency>
    <dependency>
        <artifactId>canova-nd4j-codec</artifactId>
        <groupId>org.nd4j</groupId>
        <version>${canova.version}</version>
    </dependency>
    <dependency>
        <groupId>org.deeplearning4j</groupId>
        <artifactId>deeplearning4j-nlp</artifactId>
        <version>${dl4j.version}</version>
    </dependency>
    <dependency>
        <groupId>org.deeplearning4j</groupId>
        <artifactId>deeplearning4j-core</artifactId>
        <version>${dl4j.version}</version>
    </dependency>
    <dependency>
        <groupId>org.deeplearning4j</groupId>
        <artifactId>deeplearning4j-ui</artifactId>
        <version>${dl4j.version}</version>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>2.0.2-beta</version>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>2.0.42-beta</version>
    </dependency>
    <dependency>
        <groupId>org.quartz-scheduler</groupId>
        <artifactId>quartz</artifactId>
        <version>2.2.2</version>
    </dependency>
    <dependency>
        <groupId>org.quartz-scheduler</groupId>
        <artifactId>quartz-jobs</artifactId>
        <version>2.2.2</version>
    </dependency>
    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
        <version>2.4.4</version>
    </dependency>
    <dependency>
        <groupId>com.carrotsearch.randomizedtesting</groupId>
        <artifactId>randomizedtesting-runner</artifactId>
        <version>${randomizedtesting-runner.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.lucene</groupId>
        <artifactId>lucene-test-framework</artifactId>
        <version>${lucene.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <version>${elasticsearch.version}</version>
        <scope>test</scope>
        <type>test-jar</type>
    </dependency>
    <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <version>${elasticsearch.version}</version>
        <scope>test</scope>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>2.1</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <transformers>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <mainClass>com.project.ProjectLauncher</mainClass>
                            </transformer>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                        </transformers>
                        <filters>
                            <filter>
                                <artifact>*:*</artifact>
                                <excludes>
                                    <exclude>META-INF/*.SF</exclude>
                                    <exclude>META-INF/*.DSA</exclude>
                                    <exclude>META-INF/*.RSA</exclude>
                                </excludes>
                            </filter>
                        </filters>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>com.project.ProjectLauncher</mainClass>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
    </plugins>
</build>
</project>

为什么会发生这种情况,我该如何解决?

任何帮助将不胜感激!谢谢!

0 个答案:

没有答案