I used the gluon plugin to create a new single view project and changed nothing in its files. If I use the gradle task application > run
it works fine. But if I
When you execute the jar
task on a Gluon project, you will get just a jar with the classes and resources under the main and desktop packages of your project. In your case, something like this:
That jar contains the main class, but it doesn't contain any of the dependencies (Gluon Charm).
If you want to create an executable jar, you need to create a shadowJar
or fatJar
, that bundles all the dependencies within that jar.
You can add this plugin for it: com.github.johnrengelman.shadow
, based on this project.
Once you add the plugin, all you need to do is let it know about your custom configurations, as it doesn't know about the Desktop one.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.1.1'
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.4'
}
}
apply plugin: 'org.javafxports.jfxmobile'
apply plugin: 'com.github.johnrengelman.shadow'
...
// Add desktop dependencies to the task
shadowJar {
configurations = [project.configurations.desktopRuntime]
}
Reload your project and execute shadowJar
. You can find it under the Tasks menu:
You will find your executable jar under /builds/libs/yourProjectName-all.jar.