When used as an embedded database in Java 9+ with the Java module system, Maven will produce a big warning message surrounded with stars:
[WARNING] ************************
[WARNING] * Required filename-based automodules detected: [hsqldb-2.5.0.jar]. Please don't publish this project to a public artifact repository! *
[WARNING] **************************
This warning is raised because the module name is not considered stable, as it can change at any time.
This can be fixed in a backwards-compatible way by declaring the module name in the jar manifest (META-INF/MANIFEST.MF):
Automatic-Module-Name: hsqldb
An explanation of why maven get's grumpy about this can be found here: https://blog.joda.org/2017/05/java-se-9-jpms-automatic-modules.html
You can compile the source with Java 9+ and it will produce a Java module jar. Please try this and report any issue.
Hi, that's great, and I'll give it a try, I think though, all the more so, that the jar in Maven central should match the module name in the Java 9 build. As it is, switching between them will break any downstream module-info files, because the filename based module name is hsqldb and the module-info.java is org.hsqldb. Not everyone is going to want to maintain their own internal build, I would think. If the Java 8 build includes the automatic module name as org.hsqldb, then there won't be any difficult moving between the two.
It would be helpful to have the version on maven central declare Automatic-Module-Name. I am operating in a non-standard environment where database drivers are downloaded on the fly - concerned users might wonder why hsqldb is coming from an internal repo rather than maven central.
I am not aware of any definitive guide on how to achieve this. Maven uses names with version numbers while Java module names are version independent. Furthermore, there are two distinct jars published by hsqldb.org, namely, hsqldb and sqltool.
Last edit: Fred Toussi 2020-08-20
The way I understand it, only a manifest attribute is required to specify the automatic module name. However, it does seem that hsqldb and sqltool split the org.hsqldb.lib and org.hsqldb.resources packages, which could prove to be a challenge since automatic modules do not permit split packages.
Thanks. I think we should build and publish Java module jars for both hsqldb and sqltool. We already have the module-info class and can build for Java 9 and above. This jar does not expose the lib and resource classes.
Last edit: Fred Toussi 2020-08-24
From version 2.6.0, jars are Java modules, named org.hsqldb .