In my java project, I need to use neo4j-1.9.3 that depends on lucene-3.6.2, and ElasticSearch which depends on lucene-4.4.0. I know that if I want to use two versions of lucene directly, I can use ClassLoader to load different classes from the lucenes.
But the problem is that I won't use lucene's apis directly now. Is there any way that lucene-3.6.2 can be loaded when neo4j's apis are running, and lucene-4.4.0 can be loaded while running elasticsearch's apis. The two versions of lucene conflict now, and I need to run neo4j and elasticsearch in one project. How could I solve the dependency problem?
Thanks in advance.
You could still use a ClassLoader solution, but that is a nasty business where it is easy to make mistakes.
You could also use different JVM's.
But the solution I would personally choose is either (or both) of the following: