Closed strudelPie closed 3 months ago
For a reference to how Gradle determines if a dependency is a module or not, see the documentation for the Java Library plugin:
To tell the Java compiler that a Jar is a module, as opposed to a traditional Java library, Gradle needs to place it on the so called module path. It is an alternative to the classpath, which is the traditional way to tell the compiler about compiled dependencies. Gradle will automatically put a Jar of your dependencies on the module path, instead of the classpath, if these three things are true:
java.modularity.inferModulePath
is not turned offWe are actually building a module (as opposed to a traditional library) which we expressed by adding the
module-info.java
file. (Another option is to add theAutomatic-Module-Name
Jar manifest attribute as described further down.)The Jar our module depends on is itself a module, which Gradles decides based on the presence of a
module-info.class
— the compiled version of the module descriptor — in the Jar. (Or, alternatively, the presence of anAutomatic-Module-Name
attribute the Jar manifest)
Note the documentation for the Application plugin refers you back to the above documentation.
Could you please add module-info
? It's pretty inconvenient to use moditect each time to generate module descriptor. The latter is mandatory for tools like jlink
or jpackage
, which is the primary way to distribute Java desktop apps. Recent JavaFX versions require JDK17. Does it worth to keep FX8 compatibility for that long...
Yes, please add module-info! It is 2023 .... time to add it! :-)
Solved with ##29
Gradle build hits runtime error.
Please see StackOverflow question here for full annotated explanation: https://stackoverflow.com/questions/70137886/why-do-i-get-a-runtime-error-when-trying-to-use-and-run-external-library-animate
In particular please note the discussion in the StackOverflow comments section of the post. Essentially: Gradle only adds dependencies to the module-path if they have a module-info descriptor or if they have an Automatic-Module-Name entry in the manifest file. The AnimateFX library has neither, and so Gradle does not put the dependency on the module-path. I'm not sure if there's a way around this problem while keeping your code modular, which is a need.
System Information