Lucene 9.0 Java module system support

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Lucene 9.0 Java module system support

David Ryan-2

Hi all,

I've been investigating the use of Lucene as part of an application that uses the Java Module System. Initially, I used Gradle to bring in lucene-core, lucene-spatial and lucene-queries using version 8.5.0. This works with the automated module naming. However, bringing in lucene-queryparser (which depends on lucene-sandbox) or lucene-analyzers-common causes errors such as:

"The package org.apache.lucene.analysis.standard is accessible from more than one module: lucene.analyzers.common, lucene.core"

The Java module system does not handle different jar files using the same package name which occurs throughout multiple maven artifacts.

Looking at the LUCENE issues, I found the task of moving to a minimum version of Java 11, however, this does not mention the ability to be compatible with the module system.  I also checked the git repository and couldn't find the required changes to support the module system.


I looked through the dev list recent history but could not find anything related. Are there any plans to support modules? Given, I saw there are a number of other breaking changes happening with the move to Lucene 9.0, would it be good to make those changes?

Thanks,
David.

Reply | Threaded
Open this post in threaded view
|

RE: Lucene 9.0 Java module system support

Uwe Schindler

Hi,

 

this is a known problem since many year and there are no plans to change this yet. The main reason for Java 11 support is not to introduce the module system, but instead use the new features of Java 11 and to get rid MR-JAR complications to make use of new intrinsics.

 

Servers like Solr or Elasticsearch are shipped as an application, so the module system does not bring any benefit.

 

Th general recommendation is to combine all required Lucene libraries into a separate JAR file during the maven / gradle build (e.g. using the Maven Shade plugin). Keep in mind that Lucene is also not suitable for use in other module systems like

 

There is currently some preparatory things to move forward with modules, so although you might be able to actually compile Lucene with module system (by limiting to a subset of JAR files), it currently won’t work cross-module due to the way how it handles ServiceLoader interfaces (codecs, postings formats, analyzers, see https://issues.apache.org/jira/browse/LUCENE-9281). The only way to make it work at runtime is to put all of Lucene into one module.

 

Uwe

 

-----

Uwe Schindler

Achterdiek 19, D-28357 Bremen

https://www.thetaphi.de

eMail: [hidden email]

 

From: David Ryan <[hidden email]>
Sent: Tuesday, March 24, 2020 8:05 AM
To: [hidden email]
Subject: Lucene 9.0 Java module system support

 

 

Hi all,

 

I've been investigating the use of Lucene as part of an application that uses the Java Module System. Initially, I used Gradle to bring in lucene-core, lucene-spatial and lucene-queries using version 8.5.0. This works with the automated module naming. However, bringing in lucene-queryparser (which depends on lucene-sandbox) or lucene-analyzers-common causes errors such as:

 

"The package org.apache.lucene.analysis.standard is accessible from more than one module: lucene.analyzers.common, lucene.core"

 

The Java module system does not handle different jar files using the same package name which occurs throughout multiple maven artifacts.

 

Looking at the LUCENE issues, I found the task of moving to a minimum version of Java 11, however, this does not mention the ability to be compatible with the module system.  I also checked the git repository and couldn't find the required changes to support the module system.

 

 

I looked through the dev list recent history but could not find anything related. Are there any plans to support modules? Given, I saw there are a number of other breaking changes happening with the move to Lucene 9.0, would it be good to make those changes?

 

Thanks,

David.