简体   繁体   中英

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. The scenario look as follows:

jar A uses Lucene 4.9.0 jar B uses 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.

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.

Your declaration of B should look something like this:

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

Include any other lucene jars that might conflict in that list as well.

If you aren't specifically utilizing any lucene libraries (aside from the elasticsearch plugin) in your code, you can remove the explicit Lucene declarations.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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