-
Notifications
You must be signed in to change notification settings - Fork 443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JlinkPlugin: properly handle external modules #1247
Comments
One more problem with |
Here's a less breaking way to manage the split:
This way we get to keep all the tests in |
Few more possibilities:
|
I finally got around to
jlink
'ing actual modular JARs (in a larger project), and the current implementation doesn't work.We build
--module-path
using commas as separators. Jlink documentation for Java 9 and 10 seems to suggest semicolons instead. Documentation for Java 11 and Java 12 doesn't mention that at all, but colons (!) seem to work.--module-path
supports following items:For non-modular JARs
jlink
tries to generate an automatic module descriptor, using the JAR's file name. If that results in an illegal module name (like, say,cats.core.2.12
), then it raises an error:What happens now, is that comma-separated
--module-path
list is treated as a single path. Since such file doesn't exist, the effective--module-path
is empty. This works when using the standard modules, but fails once we start adding external modular JARs. Also, this huge path can reach OS path size limits, resulting in an exception when runningjlink
.A short-term fix for this looks like this:
--module-path
separator issue.--module-path
list. One way to do this would bejar -d -f <file>
(though that looks troublesome, since it also generates an automatic module descriptor).However, I have reservations about adding more command-line utilities to the mix. I think we've come to the point where it makes more sense to leverage
java.lang.module
for things like that, even though that would mean thatJlinkPlugin
would requireSBT
to run in Java 9+.Therefore, a better fix looks like this:
JlinkPlugin
to a separate artifact or project (sbt-native-packager-jlink
), that would require Java 9 to build/use.java.lang.module
to detect module JARs.jdeps
package graph analysis with directly analyzing working with modules viajava.lang.module
.This way we are isolated from changes in
jdeps
/jar
output, and we have a lot of flexibility when dealing with modules. We losejdeps
package dependency check, but I'd argue it is not in the scope of this plugin.The text was updated successfully, but these errors were encountered: