我有一个弹簧启动项目,我按如下方式定义弹性搜索依赖项。
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>5.5.0</version><!--$NO-MVN-MAN-VER$ -->
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>5.5.0</version>
<exclusions>
<exclusion>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.elasticsearch.plugin</groupId>
<artifactId>transport-netty4-client</artifactId>
<version>5.5.0</version>
</dependency>
现在看起来就像在该项目中一样
现在我导入将此项目添加到另一个Spring启动项目,结果将跟随。当我使用5.5.0时,我不确定为什么弹性版本会变成2.4.5。有什么想法吗?
依赖树
[INFO] com.yatri.boot.search:yatri-search:jar:0.0.1-SNAPSHOT
[INFO] +- org.elasticsearch:elasticsearch:jar:5.5.0:compile
[INFO] | +- org.apache.lucene:lucene-core:jar:6.6.0:compile
[INFO] | +- org.apache.lucene:lucene-analyzers-common:jar:6.6.0:compile
[INFO] | +- org.apache.lucene:lucene-backward-codecs:jar:6.6.0:compile
[INFO] | +- org.apache.lucene:lucene-grouping:jar:6.6.0:compile
[INFO] | +- org.apache.lucene:lucene-highlighter:jar:6.6.0:compile
[INFO] | +- org.apache.lucene:lucene-join:jar:6.6.0:compile
[INFO] | +- org.apache.lucene:lucene-memory:jar:6.6.0:compile
[INFO] | +- org.apache.lucene:lucene-misc:jar:6.6.0:compile
[INFO] | +- org.apache.lucene:lucene-queries:jar:6.6.0:compile
[INFO] | +- org.apache.lucene:lucene-queryparser:jar:6.6.0:compile
[INFO] | +- org.apache.lucene:lucene-sandbox:jar:6.6.0:compile
[INFO] | +- org.apache.lucene:lucene-spatial:jar:6.6.0:compile
[INFO] | +- org.apache.lucene:lucene-spatial-extras:jar:6.6.0:compile
[INFO] | +- org.apache.lucene:lucene-spatial3d:jar:6.6.0:compile
[INFO] | +- org.apache.lucene:lucene-suggest:jar:6.6.0:compile
[INFO] | +- org.elasticsearch:securesm:jar:1.1:compile
[INFO] | +- net.sf.jopt-simple:jopt-simple:jar:5.0.2:compile
[INFO] | +- com.carrotsearch:hppc:jar:0.7.1:compile
[INFO] | +- joda-time:joda-time:jar:2.9.9:compile
[INFO] | +- org.yaml:snakeyaml:jar:1.17:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-core:jar:2.8.8:compile
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-smile:jar:2.8.8:compile
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.8.8:compile
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.8.8:compile
[INFO] | +- com.tdunning:t-digest:jar:3.0:compile
[INFO] | +- org.hdrhistogram:HdrHistogram:jar:2.1.9:compile
[INFO] | +- org.apache.logging.log4j:log4j-api:jar:2.7:compile
[INFO] | \- org.elasticsearch:jna:jar:4.4.0:compile
[INFO] +- org.elasticsearch.client:transport:jar:5.5.0:compile
[INFO] | +- org.elasticsearch.plugin:transport-netty3-client:jar:5.5.0:compile
[INFO] | | \- io.netty:netty:jar:3.10.6.Final:compile
[INFO] | +- org.elasticsearch.plugin:transport-netty4-client:jar:5.5.0:compile
[INFO] | | +- io.netty:netty-buffer:jar:4.1.11.Final:compile
[INFO] | | +- io.netty:netty-codec:jar:4.1.11.Final:compile
[INFO] | | +- io.netty:netty-codec-http:jar:4.1.11.Final:compile
[INFO] | | +- io.netty:netty-common:jar:4.1.11.Final:compile
[INFO] | | +- io.netty:netty-handler:jar:4.1.11.Final:compile
[INFO] | | +- io.netty:netty-resolver:jar:4.1.11.Final:compile
[INFO] | | \- io.netty:netty-transport:jar:4.1.11.Final:compile
[INFO] | +- org.elasticsearch.plugin:reindex-client:jar:5.5.0:compile
[INFO] | | \- org.elasticsearch.client:rest:jar:5.5.0:compile
[INFO] | | +- org.apache.httpcomponents:httpclient:jar:4.5.3:compile
[INFO] | | +- org.apache.httpcomponents:httpcore:jar:4.4.6:compile
[INFO] | | +- org.apache.httpcomponents:httpasyncclient:jar:4.1.3:compile
[INFO] | | +- org.apache.httpcomponents:httpcore-nio:jar:4.4.5:compile
[INFO] | | +- commons-codec:commons-codec:jar:1.10:compile
[INFO] | | \- commons-logging:commons-logging:jar:1.1.3:compile
[INFO] | +- org.elasticsearch.plugin:lang-mustache-client:jar:5.5.0:compile
[INFO] | | \- com.github.spullara.mustache.java:compiler:jar:0.9.3:compile
[INFO] | +- org.elasticsearch.plugin:percolator-client:jar:5.5.0:compile
[INFO] | \- org.elasticsearch.plugin:parent-join-client:jar:5.5.0:compile
[INFO] +- com.yatri.boot.init:yatri-init:jar:0.0.1-SNAPSHOT:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-web:jar:1.5.4.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter:jar:1.5.4.RELEASE:compile
[INFO] | | | \- org.springframework.boot:spring-boot-starter-logging:jar:1.5.4.RELEASE:compile
[INFO] | | | +- ch.qos.logback:logback-classic:jar:1.1.11:compile
[INFO] | | | | \- ch.qos.logback:logback-core:jar:1.1.11:compile
[INFO] | | | +- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
[INFO] | | | \- org.slf4j:log4j-over-slf4j:jar:1.7.25:compile
[INFO] | | +- org.hibernate:hibernate-validator:jar:5.3.5.Final:compile
[INFO] | | | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | | | \- com.fasterxml:classmate:jar:1.3.3:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.8:compile
[INFO] | | +- org.springframework:spring-web:jar:4.3.9.RELEASE:compile
[INFO] | | | \- org.springframework:spring-aop:jar:4.3.9.RELEASE:compile
[INFO] | | \- org.springframework:spring-webmvc:jar:4.3.9.RELEASE:compile
[INFO] | | \- org.springframework:spring-expression:jar:4.3.9.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-data-mongodb:jar:1.5.4.RELEASE:compile
[INFO] | | +- org.mongodb:mongodb-driver:jar:3.4.2:compile
[INFO] | | | +- org.mongodb:bson:jar:3.4.2:compile
[INFO] | | | \- org.mongodb:mongodb-driver-core:jar:3.4.2:compile
[INFO] | | \- org.springframework.data:spring-data-mongodb:jar:1.10.4.RELEASE:compile
[INFO] | | \- org.springframework:spring-tx:jar:4.3.9.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-cache:jar:1.5.4.RELEASE:compile
[INFO] | | +- org.springframework:spring-context:jar:4.3.9.RELEASE:compile
[INFO] | | \- org.springframework:spring-context-support:jar:4.3.9.RELEASE:compile
[INFO] | +- com.hazelcast:hazelcast:jar:3.7.7:compile
[INFO] | +- com.hazelcast:hazelcast-spring:jar:3.7.7:compile
[INFO] | +- com.google.guava:guava:jar:22.0:compile
[INFO] | | +- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] | | +- com.google.errorprone:error_prone_annotations:jar:2.0.18:compile
[INFO] | | +- com.google.j2objc:j2objc-annotations:jar:1.1:compile
[INFO] | | \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile
[INFO] | +- org.reflections:reflections:jar:0.9.11:compile
[INFO] | | \- org.javassist:javassist:jar:3.21.0-GA:compile
[INFO] | +- commons-fileupload:commons-fileupload:jar:1.3.3:compile
[INFO] | | \- commons-io:commons-io:jar:2.2:compile
[INFO] | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.8.8:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile
[INFO] | +- org.aspectj:aspectjrt:jar:1.8.10:compile
[INFO] | \- org.aspectj:aspectjweaver:jar:1.8.10:compile
[INFO] +- org.apache.logging.log4j:log4j-core:jar:2.8.2:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.5:compile
[INFO] +- org.springframework.data:spring-data-commons:jar:1.13.4.RELEASE:compile
[INFO] | +- org.springframework:spring-core:jar:4.3.9.RELEASE:compile
[INFO] | +- org.springframework:spring-beans:jar:4.3.9.RELEASE:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] | \- org.slf4j:jcl-over-slf4j:jar:1.7.25:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.5.4.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:1.5.4.RELEASE:test
[INFO] | | \- org.springframework.boot:spring-boot:jar:1.5.4.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.5.4.RELEASE:test
[INFO] | | \- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.4.RELEASE:compile
[INFO] | +- com.jayway.jsonpath:json-path:jar:2.2.0:test
[INFO] | | \- net.minidev:json-smart:jar:2.2.1:test
[INFO] | | \- net.minidev:accessors-smart:jar:1.1:test
[INFO] | | \- org.ow2.asm:asm:jar:5.0.3:test
[INFO] | +- junit:junit:jar:4.12:test
[INFO] | +- org.assertj:assertj-core:jar:2.6.0: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.skyscreamer:jsonassert:jar:1.4.0:test
[INFO] | | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] | \- org.springframework:spring-test:jar:4.3.9.RELEASE:test
[INFO] +- org.hamcrest:hamcrest-junit:jar:2.0.0.0:test
[INFO] | \- org.hamcrest:java-hamcrest:jar:2.0.0.0:test
[INFO] \- org.springframework.boot:spring-boot-starter-undertow:jar:1.5.4.RELEASE:compile
[INFO] +- io.undertow:undertow-core:jar:1.4.15.Final:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.3.1.Final:compile
[INFO] | +- org.jboss.xnio:xnio-api:jar:3.3.6.Final:compile
[INFO] | \- org.jboss.xnio:xnio-nio:jar:3.3.6.Final:runtime
[INFO] +- io.undertow:undertow-servlet:jar:1.4.15.Final:compile
[INFO] | \- org.jboss.spec.javax.annotation:jboss-annotations-api_1.2_spec:jar:1.0.0.Final:compile
[INFO] +- io.undertow:undertow-websockets-jsr:jar:1.4.15.Final:compile
[INFO] | \- org.jboss.spec.javax.websocket:jboss-websocket-api_1.1_spec:jar:1.1.0.Final:compile
[INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO] \- org.glassfish:javax.el:jar:3.0.0:compile
答案 0 :(得分:0)
在父POM中制作线条
<dependencyManagement>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>5.5.0</version><!--$NO-MVN-MAN-VER$ -->
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>5.5.0</version>
<exclusions>
<exclusion>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.elasticsearch.plugin</groupId>
<artifactId>transport-netty4-client</artifactId>
<version>5.5.0</version>
</dependency>
</dependencyManagement>
答案 1 :(得分:0)
通过将以下属性添加到父POM来解决。第二个项目中的Spring启动器正在拉动2.4.5只是认为弹性搜索是在类路径中。
<elasticsearch.version>5.5.0</elasticsearch.version>