Hi all,
I was hit by this problem when trying to use some Scala libraries in a Maven project - Maven is required to compile Scala/Android projects with GraalVM Native Image. (I will look into using sbt but it’s a bigger issue). So instead, for now, I wrote a plugin that modifies the manifest file of a given Scala JAR in the local Maven repo. It adds a line Automatic-Module-Name: <library name> and it looks like this is enough.
I imagine it’s a very rare situation to build Scala with Maven and Java 9+, but if you do that, please try it out:
Also, I have a big favour to ask to any library creator and maintainer: Please, add automatic module names to your libs. I know in most cases it’s not necessary, but it also won’t hurt anyone. If you use sbt to build your lib, you only need to add these two lines somewhere in your build.sbt:
Compile / packageBin / packageOptions +=
Package.ManifestAttributes("Automatic-Module-Name" -> name.value)
(name here is the name of the library, without the version suffix).