First step: define automatic module names (no module-info) and restore the tests with java modules that we had in Search 5. These tests, obviously, will only be executed when building with JDK9+.
Second step: add a Maven profile to our POM (-Pmodule-descriptors ) with all the necessary configuration so that our POM defines module-info files.
We should explore https://github.com/moditect/moditect.
Third step: Check, when building with JDK11+, those module-info files are actually used by the java module tests we added in step 1. If everything works (I doubt it will), enable that profile by default on JDK11+, so that we test it regularly in the CI.
The goal is NOT:
to define full module-info descriptor for consumption by our users: we will just experiment and try to see if that works. Even if that works, we do not currently want to switch to JDK11 for our release build, so we simply cannot release module-info descriptors for now.
to make tests pass with module-info descriptors. It's likely that we will have to change some things in Hibernate Search, or even in Lucene, and that will be addressed in HSEARCH-3274 .