简体   繁体   English

Lucene对Grails的依赖梦night

[英]Grails dependency nightmare with Lucene

I have recently updated Elastic Search from 0.90.0 to 1.3.2 and now I'm getting a conflict with a Lucene version used by another dependency. 我最近将Elastic Search从0.90.0更新到1.3.2,现在与另一个依赖项使用的Lucene版本发生冲突。 The scenario look as follows: 该方案如下所示:

jar A uses Lucene 4.9.0 jar B uses Lucene 3.3.0 罐A使用Lucene 4.9.0罐B使用Lucene 3.3.0

The point is that I'm getting a java.lang.VerifyError because B code is overriding a final method of a Lucene's class which is not final at 4.9.0 version. 关键是我得到一个java.lang.VerifyError,因为B代码覆盖了Lucene类的final方法,该方法在4.9.0版本中不是final。

I've tried this with no success: 我尝试了这个没有成功:

compile ('A')
compile ('B')
compile ('org.apache.lucene:lucene-core:4.9.0') {
    excludes(B)
}
compile ('org.apache.lucene:lucene-analyzers-common:4.9.0') {
    excludes(B)
}

I don't know what more to do, any clues on this? 我不知道该怎么办,这有什么线索吗?

Thanks! 谢谢!

Assuming you want the latest version of Lucene, your exclusions are actually backwards. 假设您需要最新版本的Lucene,则排除的对象实际上是向后的。

Your declaration of B should look something like this: 您对B的声明应如下所示:

compile ('B') {
    excludes "lucene-core", "lucene-analyzers-common"
}

Include any other lucene jars that might conflict in that list as well. 在该列表中也包括任何其他可能冲突的lucene jars。

If you aren't specifically utilizing any lucene libraries (aside from the elasticsearch plugin) in your code, you can remove the explicit Lucene declarations. 如果您没有在代码中专门使用任何Lucene库(除了elasticsearch插件之外),则可以删除显式Lucene声明。

I don't know enough about Lucene to tell you whether 4.9.0 is backwards compatible with 3.3.0, but this solution should at least make sure that 4.9.0 is what is on your project's classpath, and not 3.3.0 我对Lucene的了解还不足以告诉您4.9.0是否与3.3.0向后兼容,但是此解决方案至少应确保4.9.0是项目的类路径中的内容,而不是 3.3.0

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

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