Subject: Lucene 9.0 Java module system support


While the module system sounds nice in theory, my experience is
unfortunately that it is quite difficult to use for any application with
many existing dependencies, 90% or more of projects don't use it and
therefore wind up in the default module. I've wasted many hours trying to
get it to work in fat jar packaging situations (JesterJ uses my fork of
one-jar, uno-jar) and that is nearly impossible. In order to use it one has
to be willing to issue a very large number of --add-opens or --add-imports
directives on the command line, which totally obliterates the nice java
-jar myJar.jar command-line invocation, and creates a *requirement* for a
startup script which then also has to maintain that list of directives
(more cost than gain, but tractable for cases where there is a startup
script, intractable for fat jars that want to be executable).

There are allegedly manifest attributes, and you can find reference to
add-exports attribute if you dig long enough to find the archives emails
that were part of the JCP process... or more recently here:
https://www.jrebel.com/blog/java-9-modules-cheat-sheet... but they are not
documented here:
https://docs.oracle.com/en/java/javase/11/docs/specs/jar/jar.html and while
add-exports seems to work in the manifest, add-opens did not (at least when
I tried to use it). I have yet to find either attribute in any official
documentation despite hours of looking.

My general inclination has become that modules of negative value for any
project that uses jars that were not written by the project or a project
they control, or has zero external dependencies, which is sad because
that's what it was supposed to help fix. The primary reason for this is the
inability to see into the default module if you declare a module, and the
error mentioned at the top of this thread, which leaves one re-packaging
3rd party libraries (more cost than gain, possible license implications).

I've generally concluded it's best to avoid modules unless it's forced on
me for some reason. I've yet to feel a module helped me but many many times
I found that it got in the way.

YMMV,
Gus

On Fri, Apr 10, 2020 at 2:30 AM David Ryan <[EMAIL PROTECTED]> wrote:

http://www.needhamsoftware.com (work)
http://www.the111shift.com (play)