-
Notifications
You must be signed in to change notification settings - Fork 11
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
Error: automatic module cannot be used with jlink: com.sun.jna #7
Comments
Hi @titinko thank you for your report. I actually haven't tried jlink yet but I think there will be a solution. I probably have to rework the module-info a bit using jdeps. |
Moditect might help here too, I'll have to give it a try. |
So, there are a few aspects to this issue. First, the good news: JNA is the only non-modular dependency and they already added JPMS support for the next release (java-native-access/jna#1237 and https://github.com/java-native-access/jna/blob/master/CHANGES.md), so we only need to find a temporary solution until this will be available. Unfortunately, I could not find any details on when this will be release, however all planned features seem to be completed. Next, we can use moditect to add a <plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
<version>1.0.0.RC1</version>
<executions>
<execution>
<id>add-module-infos</id>
<phase>generate-resources</phase>
<goals>
<goal>add-module-info</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/modules</outputDirectory>
<overwriteExistingFiles>true</overwriteExistingFiles>
<modules>
<module>
<artifact>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.6.0</version>
</artifact>
<moduleInfoSource>
module com.sun.jna {
exports com.sun.jna;
exports com.sun.jna.ptr;
exports com.sun.jna.win32;
exports com.sun.jna.internal to com.sun.jna.platform;
requires java.logging;
opens com.sun.jna.darwin;
}
</moduleInfoSource>
</module>
</modules>
</configuration>
</execution>
</executions>
</plugin> The problem however is that it is currently not so simple to use this with the If someone has a good idea on how to add the moditect-modded module to the module path for jlink, please let me know! If I find any other solution, i'll let you know. I also tried to use the "regular" (non-javafx) jlink maven plugin (https://maven.apache.org/plugins/maven-jlink-plugin/) but couldn't really get this to work due to
Any ideas maybe on how to work around that? |
I think we're close: java-native-access/jna@be5eec5 |
The day has finally come! if you update to the latest version |
I tried again and the library builds perfectly now, so I've added it to my project and now have the Preferences menu item in the right place. Thank you so much! |
Does NSMenuFX currently not work with jlink?
I tried importing the library in my pom.xml:
then added the nsmenufx module to module-info.java:
The library works fine when I run it locally (mvn javafx:run) but when I try to deploy with jlink (mvn javafx:jlink) I get the does-not-work-with-jlink error:
I had assumed from codecentric#36 that this fork would be jlink-compatible, but is it not there quite yet? Or is there another dependency/module I'm not adding properly? Thanks!
The text was updated successfully, but these errors were encountered: