2015-05-05 3 views
1

Я пытаюсь использовать ElasticsearchIntegrationTest (http://www.elastic.co/guide/en/elasticsearch/reference/1.x/integration-tests.html) для моих тестов интеграции в приложении Spring Boot.ElasticsearchIntegrationTest с Spring Boot

@ElasticsearchIntegrationTest.ClusterScope(scope =ElasticsearchIntegrationTest.Scope.SUITE) 
public class MyElasticsearchIntegrationTests extends ElasticsearchIntegrationTest 

Когда я запускаю этот тест, я получаю следующее сообщение об ошибке:

java.lang.AssertionError: Version must be upgraded to [4.10.4] is still set to  [4.10.3] 
at org.elasticsearch.Version.<clinit>(Version.java:229) 
at org.elasticsearch.test.ElasticsearchTestCase.<clinit>(ElasticsearchTestCase.java:87) 
at java.lang.Class.forName0(Native Method) 
at java.lang.Class.forName(Class.java:348) 
at com.carrotsearch.randomizedtesting.RandomizedRunner$1.run(RandomizedRunner.java:553) 

Мои зависимостей определяются как это в моем pom.xml:

<dependencies> 
    <dependency> 
     <groupId>org.elasticsearch</groupId> 
     <artifactId>elasticsearch</artifactId> 
     <version>1.5.1</version> 
     <type>test-jar</type> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.lucene</groupId> 
     <artifactId>lucene-test-framework</artifactId> 
     <version>4.10.4</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-data-elasticsearch</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-web</artifactId> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-test</artifactId> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.data</groupId> 
     <artifactId>spring-data-elasticsearch</artifactId> 
     <version>1.3.0.BUILD-SNAPSHOT</version> 
    </dependency> 
    <dependency> 
     <groupId>com.google.guava</groupId> 
     <artifactId>guava</artifactId> 
     <version>18.0</version> 
    </dependency> 
</dependencies> 

И когда я бегу МВН dependecy: дерево

[INFO] Scanning for projects... 
[INFO]                  
[INFO] ------------------------------------------------------------------------ 
[INFO] Building demo 0.0.1-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ demo --- 
[INFO] com.sebpc:demo:jar:0.0.1-SNAPSHOT 
[INFO] +- org.elasticsearch:elasticsearch:test-jar:tests:1.5.1:test 
[INFO] | +- org.apache.lucene:lucene-core:jar:4.10.4:compile 
[INFO] | +- org.apache.lucene:lucene-analyzers-common:jar:4.10.4:compile 
[INFO] | +- org.apache.lucene:lucene-queries:jar:4.10.4:compile 
[INFO] | +- org.apache.lucene:lucene-memory:jar:4.10.4:compile 
[INFO] | +- org.apache.lucene:lucene-highlighter:jar:4.10.4:compile 
[INFO] | +- org.apache.lucene:lucene-queryparser:jar:4.10.4:compile 
[INFO] | +- org.apache.lucene:lucene-sandbox:jar:4.10.4:compile 
[INFO] | +- org.apache.lucene:lucene-suggest:jar:4.10.4:compile 
[INFO] | +- org.apache.lucene:lucene-misc:jar:4.10.4:compile 
[INFO] | +- org.apache.lucene:lucene-join:jar:4.10.4:compile 
[INFO] | +- org.apache.lucene:lucene-grouping:jar:4.10.4:compile 
[INFO] | +- org.apache.lucene:lucene-spatial:jar:4.10.4:compile 
[INFO] | | \- com.spatial4j:spatial4j:jar:0.4.1:compile 
[INFO] | +- org.antlr:antlr-runtime:jar:3.5:compile 
[INFO] | +- org.ow2.asm:asm:jar:4.1:compile 
[INFO] | \- org.ow2.asm:asm-commons:jar:4.1:compile 
[INFO] +- org.apache.lucene:lucene-test-framework:jar:4.10.4:compile 
[INFO] | +- org.apache.lucene:lucene-codecs:jar:4.10.4:compile 
[INFO] | +- com.carrotsearch.randomizedtesting:junit4-ant:jar:2.1.6:compile 
[INFO] | +- com.carrotsearch.randomizedtesting:randomizedtesting- runner:jar:2.1.6:compile 
[INFO] | +- junit:junit:jar:4.12:compile 
[INFO] | \- org.apache.ant:ant:jar:1.8.2:compile 
[INFO] +- org.springframework.boot:spring-boot-starter-data-elasticsearch:jar:1.3.0.BUILD-SNAPSHOT:compile 
[INFO] | \- org.springframework.boot:spring-boot-starter:jar:1.3.0.BUILD-SNAPSHOT:compile 
[INFO] |  +- org.springframework.boot:spring-boot:jar:1.3.0.BUILD-SNAPSHOT:compile 
[INFO] |  +- org.springframework.boot:spring-boot-autoconfigure:jar:1.3.0.BUILD-SNAPSHOT:compile 
[INFO] |  +- org.springframework.boot:spring-boot-starter-logging:jar:1.3.0.BUILD-SNAPSHOT:compile 
[INFO] |  | +- ch.qos.logback:logback-classic:jar:1.1.3:compile 
[INFO] |  | | \- ch.qos.logback:logback-core:jar:1.1.3:compile 
[INFO] |  | +- org.slf4j:jul-to-slf4j:jar:1.7.11:compile 
[INFO] |  | \- org.slf4j:log4j-over-slf4j:jar:1.7.11:compile 
[INFO] |  \- org.yaml:snakeyaml:jar:1.14:compile 
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.3.0.BUILD-SNAPSHOT:compile 
[INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.3.0.BUILD-SNAPSHOT:compile 
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.0.21:compile 
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.0.21:compile 
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-logging-juli:jar:8.0.21:compile 
[INFO] | | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.0.21:compile 
[INFO] | +- org.springframework.boot:spring-boot-starter-validation:jar:1.3.0.BUILD-SNAPSHOT:compile 
[INFO] | | \- org.hibernate:hibernate-validator:jar:5.1.3.Final:compile 
[INFO] | |  +- javax.validation:validation-api:jar:1.1.0.Final:compile 
[INFO] | |  +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile 
[INFO] | |  \- com.fasterxml:classmate:jar:1.0.0:compile 
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.5.1:compile 
[INFO] | | \- com.fasterxml.jackson.core:jackson-annotations:jar:2.5.1:compile 
[INFO] | +- org.springframework:spring-web:jar:4.2.0.BUILD-SNAPSHOT:compile 
[INFO] | | +- org.springframework:spring-aop:jar:4.2.0.BUILD-SNAPSHOT:compile 
[INFO] | | | \- aopalliance:aopalliance:jar:1.0:compile 
[INFO] | | \- org.springframework:spring-beans:jar:4.2.0.BUILD-SNAPSHOT:compile 
[INFO] | \- org.springframework:spring-webmvc:jar:4.2.0.BUILD-SNAPSHOT:compile 
[INFO] |  \- org.springframework:spring-expression:jar:4.2.0.BUILD-SNAPSHOT:compile 
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.3.0.BUILD-SNAPSHOT:test 
[INFO] | +- org.mockito:mockito-core:jar:1.10.19:test 
[INFO] | | \- org.objenesis:objenesis:jar:2.1:test 
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:test 
[INFO] | +- org.hamcrest:hamcrest-library:jar:1.3:test 
[INFO] | +- org.springframework:spring-core:jar:4.2.0.BUILD-SNAPSHOT:compile 
[INFO] | \- org.springframework:spring-test:jar:4.2.0.BUILD-SNAPSHOT:test 
[INFO] +- org.springframework.data:spring-data-elasticsearch:jar:1.3.0.BUILD-SNAPSHOT:compile 
[INFO] | +- org.springframework:spring-context:jar:4.2.0.BUILD-SNAPSHOT:compile 
[INFO] | +- org.springframework:spring-tx:jar:4.2.0.BUILD-SNAPSHOT:compile 
[INFO] | +- org.springframework.data:spring-data-commons:jar:1.10.0.RELEASE:compile 
[INFO] | +- commons-lang:commons-lang:jar:2.6:compile 
[INFO] | +- commons-collections:commons-collections:jar:3.2.1:compile 
[INFO] | +- joda-time:joda-time:jar:2.7:compile 
[INFO] | +- org.elasticsearch:elasticsearch:jar:1.4.4:compile 
[INFO] | +- com.fasterxml.jackson.core:jackson-core:jar:2.5.1:compile 
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.11:compile 
[INFO] | \- org.slf4j:jcl-over-slf4j:jar:1.7.11:compile 
[INFO] \- com.google.guava:guava:jar:18.0:compile 

Похоже, что все библиотеки, связанные с lucene, 4.10.4, а не 4.10.3, поэтому я немного смущен этим сообщением об ошибке.

Любая помощь будет оценена!

Благодаря

ответ

0

Вы не должны определить артефакт зависимость для elasticsearch, если вы не хотите использовать конкретную версию, как она будет добавлена ​​автоматически elasticsearch весной данных.

с последним снимком elasticearch данных весны 1.3.0.BUILD-SNAPSHOT вы получите elasticsearch 1.5.2, который является последней версией в любом случае.

предложение: удалить зависимость elasticsearch от вашего pom и использовать переходную зависимость, исходящую из данных весны elasticsearch.

Если вы все еще хотите использовать определенную версию, то исключите зависимость elasticsearch от весенних данных elasticsearch.

Смежные вопросы