JFormDesigner / FlatLaf

FlatLaf - Swing Look and Feel (with Darcula/IntelliJ themes support)
https://www.formdev.com/flatlaf/
Apache License 2.0
3.34k stars 266 forks source link

gradle can’t find module com.formdev.flatlaf #466

Closed ghost closed 2 years ago

ghost commented 2 years ago

I’m trying to migrate my existing traditional project to Java 11 with support for modularity. So I’ve added a module-info.java at the src directory, requiring module com.formdev.flatlaf. Also, I’ve set the application’s mainModule property to my module, and java.modularity.inferModulePath set to true. Everything here I done is perfect for building my application as a module. But now when I try to build or run the application by ./gradle build or ./gradle run, Gradle says the module com.formdev.flatlaf can’t be found! I believe this is happening not for any of my mistake, but the library jar is responsible for this. I’m able to use other libraries in the same way, except yours.

DevCharly commented 2 years ago

Hmm, maybe Gradle does not support module-info.class in META-INF\versions\9\ sub-folder?

Please try attached flatlaf jar, which has module-info.class in root directory: flatlaf-2.0-module-info-in-root.zip (extract the ZIP)

ghost commented 2 years ago

Hmm, maybe Gradle does not support module-info.class in META-INF\versions\9\ sub-folder?

I also thought so, because after running jar tf flatlaf-2.0.jar, I can see that it’s a multi-release jar file, where the module-info.class is not in the root of the file, but in versions/9 directory. Java seems to support this type of file, as I tried to run my app manually from the command-line using java --module-path libs/myapp-1.0.jar:libs/flatlaf-2.0.jar --module my.module/my.module.app.Main and it started successfully. But Gradle seems not supporting this till now.

Please try attached flatlaf jar, which has module-info.class in root directory: flatlaf-2.0-module-info-in-root.zip (extract the ZIP)

And thanks for this! Now I’ll add it to the libs directory and add dependency locally.

DevCharly commented 2 years ago

Since FlatLaf 2.0.1, module-info.class is in root directory.