views:

338

answers:

3

I am developing an eclipse plugin which contains a specific version of Lucene. I need to generate a search index and deploy it so that it can be read by another application which uses the same version of Lucene.

I recently upgraded eclipse to 3.4 and the search index is now not readable by the 2nd application. I see that eclipse 3.4 contains a newer version of Lucene and I am assuming that this version is used when generating the index.

How can I determine exactly which version of Lucene is being used at the time the index is generated? My plugin classpath begins with my bundled version of Lucene so I would have expected that my version should get priority.

TIA

+2  A: 
VonC
A: 

Seems to work now. For those of you who are interested, this is what I had to do:

  • Removed the Lucene 1.4.3 jar from my plugin
  • Copied the old Lucene plugin from an older version of eclipse into version 3.4.
  • Deleted all the dependencies in the plugin.xml wizard. Now all the Lucene plugins are visible.
  • Selected version 1.4.xx and changed the properties to set a max version up to 1.5
  • Added the other plugin dependencies
  • Changed build path: removed old jar, added plugin dependency Lucene 1.4.3
  • Recalculated Run configuration. The Lucene 1.4.3 plugin was not added automatically so added it by hand.
  • Now when the index is generated, version 1.4.3 is loaded.

Hope this is useful to someone.

paul
A: 

Since you're developing an Eclipse plug-in you should look into OSGi. Eclipse plug-ins are instances of OSGi bundles and OSGi has a strong model for handling dependencies and versioning between bundles.

I don't know your specific code, but if was planning to use Lucene in my plug-in I'd use OSGi's 'Import-Package' or 'Require-Bundle' functionality to express the dependency; I would not include the Lucene JAR in my plug-in. If every plug-in included their own Lucene JAR, you'd waste space, but more importantly, end up with incompatible versions (like you have).

OSGI's website is not the best place to start your OSGi journey (it's good for the OSGi specifications and Peter Kriens' blog). Better to start with something like Neil Bartlett's online book.