I would like to use jlink for creating self-contained application packages for all platforms (darwin, linux, windows) from Scala source code. It seems that jlink
only works with new (relatively) jigsaw modules - so I need to package my code as a module. In Java world it seems to be easily achieved by placing special module-info.java file to the package that will become a module.
I tried to follow intuition and just placed this module-info.java into src/main/java/my.package.name/module-info.java
. Though this doesn't work. It seems that scalac
is trying to read module-info.java as usual Java file (which is not the case), hence the error
module-info.java:1:8: illegal start of type declaration [error] module my.package.name { [error] ^
What do I need to do to package my Scala code as a module?
Open JDK: 11 Scala: 2.12.4 SBT: 1.1.6