Closed hakanai closed 5 years ago
The usual tasks like distZip
or even jar
don't deal with the JavaFX dependencies unless you modify them to do so.
The JavaFX Gradle plugin helps you running the project, but it is not intended for distribution tasks.
Options:
Create a Fat/Shadow Jar if your project is not modular: https://openjfx.io/openjfx-docs/#modular, section Non-modular project with Gradle.
Use jlink to create a runtime image if your project is modular: https://openjfx.io/openjfx-docs/#modular, section Modular with Gradle.
Huh... What's the point then, if I'm the only one who can run it. :/
Anyway, I think this is the minimum to get a working distribution out the end, using jlink as suggested. Thanks for the tip, I still think it would be nice if the samples repo had this as part of the build script.
https://github.com/trejkaz/samples/blob/master/HelloFX/Gradle/hellofx/build.gradle
(Next step is to get native compilation going, but I'm not yet sure whether that's something it can do.)
As mentioned, the JavaFX gradle plugin helps you running your app, but your gradle project already relies on a set of different plugins, like Java, Application or the Modular plugin.
To help on distribution and using the jlink tool (and also the still ea jpackage tool), you can add the jlink plugin described in several places throughout the docs (gradle modular projects).
For native compilation, you may want to check the Gluon Client plugins.
I'm just trying to get a simple application up and running from an actual build. I thought the project here might provide a working example, but it turns out that it builds a non-working distribution.
Reproduction:
Result:
Am I doing something wrong? I was under the impression that the JavaFX jars fetched via Gradle would be the components it's supposed to be using.