3

In my Java project (using Maven) I have Gate 8.0 as basis for doing some natural language processing and it loads the Stemmer_Snowball plugin (see plugin list). As the documentation states the Stemmers are processing resource wrappers over the Snowball stemmers (http://snowball.tartarus.org).

Gate plus the stemmers worked well until I added Hibernate Search ORM 5.9 (thus Lucene) dependency to the project:

mvn test-compile dependency:tree
...
...
[INFO] +- org.hibernate:hibernate-search-orm:jar:5.9.0.Final:compile
[INFO] |  \- org.hibernate:hibernate-search-engine:jar:5.9.0.Final:compile
[INFO] |     +- org.apache.lucene:lucene-core:jar:5.5.5:compile
[INFO] |     +- org.apache.lucene:lucene-misc:jar:5.5.5:compile
[INFO] |     +- org.apache.lucene:lucene-analyzers-common:jar:5.5.5:compile
[INFO] |     +- org.apache.lucene:lucene-facet:jar:5.5.5:compile
[INFO] |     |  \- org.apache.lucene:lucene-queries:jar:5.5.5:compile

It turns out the lucene-analyzers-common package overrides some old version of the org.tartarus.snowball packages (see the package summary for more info) and now the custom Lucene Snowball package and the original Snowball package are incompatible:

  1. Original Snowball version: https://github.com/snowballstem/snowball/tree/master/java/org/tartarus/snowball
  2. Lucene Snowball version: https://github.com/apache/lucene-solr/tree/master/lucene/analysis/common/src/java/org/tartarus/snowball

Note that even that Lucene overrides the Snowball package classes it keeps the original package name which makes the libraries incompatible.

I want to use both Gate (with original Snowball stemmers) and Hibernate Search (with custom Lucene Snowball stemmers) in my project. Maven gracefully stops us from loading multiple versions of the same package so what should I do in that case?

Update: I added an issue on Lucene's issue tracker.

nyxz
  • 6,918
  • 9
  • 54
  • 67
  • You could use the maven `shade` plugin to shade some dependencies. See here: https://stackoverflow.com/questions/13620281/what-is-the-maven-shade-plugin-used-for-and-why-would-you-want-to-relocate-java – Rob Audenaerde Mar 07 '18 at 10:17
  • That might actually work :) I will give it a try and come back to you. Thanks! – nyxz Mar 07 '18 at 13:40
  • or another option is exclude, if you manage to dig up artifact versions of the respective stemmers – D_K Mar 12 '18 at 18:53
  • i have the same problem noen of the solutions worked , looking to exclude the old snowball stemmer from dependency – user63898 Sep 29 '21 at 06:11

0 Answers0