简体   繁体   English

Maven依赖版本冲突:Elasticsearch和Lucene

[英]Maven Dependency version conflict : Elasticsearch and Lucene

My application uses Elasticsearch's transport client to connect to ES 1.7.2 cluster. 我的应用程序使用Elasticsearch的传输客户端连接到ES 1.7.2集群。 As per the documentation , it uses Lucene 4.10.4, so below are the dependency versions in my application: 根据文档 ,它使用Lucene 4.10.4,因此以下是我的应用程序中的依赖项版本:

Elasticsearch : 1.7.2
Lucene : 4.10.4

Now, I want to use a lucene based library ( here ) to perform in memory percolation. 现在,我想使用基于Lucene的库( 此处 )在内存渗透中执行。 Looking into the pom.xml of this, it seems it uses Lucene 6.3.0 libraries. 查看此文件的pom.xml ,似乎它使用了Lucene 6.3.0库。 So, after adding this dependency, my application does not start up as Elasticsearch needs Lucene 4.10.4 and maven overrides it with 6.3.0, I have tried the following options: 因此,添加此依赖项后,我的应用程序无法启动,因为Elasticsearch需要Lucene 4.10.4,而maven用6.3.0覆盖了它,我尝试了以下选项:

  • Searched for the earlier version of percolation library that is compatible with Lucene 4.10.4 - no success 搜索与Lucene 4.10.4兼容的早期版本的渗滤库-没有成功
  • Tried making elasticsearch work with Lucene 6.3.0 - no success. 试图使Elasticsearch与Lucene 6.3.0一起使用-没有成功。 I can try updating elasticsearch dependency version but my app won't be able to connect to 1.7.2 cluster with new version (also, I can't upgrade the cluster). 我可以尝试更新elasticsearch依赖版本,但我的应用程序将无法使用新版本连接到1.7.2群集(而且,我无法升级群集)。

Any other options? 还有其他选择吗?

You can try to exclude the dependency on lucene on your other library and hope that it works with version 4.x. 您可以尝试在其他库中排除对lucene的依赖,并希望它与4.x版一起使用。

in your maven pom, do 在您的行家里,做

<dependency>
  <groupId>com.github.flaxsearch</groupId>
  <artifactId>luwak</artifactId>
  <version>1.4.0</version>
  <exclusions>
     <exclusion>
        <groupId>[the lucene lib group]</groupId>
        <artifactId>[the lucene lib artifact]</artifactId>
     </exclusion>
   </exclusions>
</dependency>

Technically, that's the way to solve version conflicts. 从技术上讲,这就是解决版本冲突的方法。 But there's no guarantee that the application can be built. 但是,不能保证可以构建该应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM