1
votes

I'm working on a javafx project with gradle, but seems like there isn't a good documentation or web site or video on how create setup for rhis kinda javafx application, I mean I found a lots of samples around ANTand MAVEN, but

I was unable to found some good practices in gradle, after that I downloadeded inno-script-studio but I don't know what to do to, at least create a jar file or executable file to make setup with. here is the plug-in I use for javafx-gradle javafx-gradle-plugin, it says on the description:

(Windows) EXE installers: Inno Setup

but I don't know how to do it

here is my build.gradle:

buildscript {
    dependencies {
        classpath group: 'de.dynamicfiles.projects.gradle.plugins', name: 'javafx-gradle-plugin', version: '8.8.2'

    }
    repositories {

        mavenLocal()
        mavenCentral()

    }
}
apply plugin: 'application'
apply plugin: 'java'
if (!hasProperty('mainClass')) {
    ext.mainClass = "Main.Launcher"
}
repositories {
    mavenLocal()
    mavenCentral()
}
dependencies{
    testCompile group: 'junit', name: 'junit', version: '4.10'
    compile "io.reactivex.rxjava2:rxjava:2.1.0"
    // https://mvnrepository.com/artifact/com.jfoenix/jfoenix
    compile group: 'com.jfoenix', name: 'jfoenix', version: '1.6.0'
    // https://mvnrepository.com/artifact/org.hibernate/hibernate-gradle-plugin
    compile group: 'org.hibernate', name: 'hibernate-gradle-plugin', version: '5.2.10.Final'
    // https://mvnrepository.com/artifact/org.hibernate/hibernate-core
    compile group: 'org.hibernate', name: 'hibernate-core', version: '5.2.10.Final'
    // https://mvnrepository.com/artifact/org.hibernate/hibernate-annotations
    compile group: 'org.hibernate', name: 'hibernate-annotations', version: '3.5.6-Final'
    // https://mvnrepository.com/artifact/mysql/mysql-connector-java
    compile group: 'mysql', name: 'mysql-connector-java', version: '6.0.6'
    // https://mvnrepository.com/artifact/log4j/log4j
    compile group: 'log4j', name: 'log4j', version: '1.2.17'
    // https://mvnrepository.com/artifact/de.jensd/fontawesomefx
    compile group: 'de.jensd', name: 'fontawesomefx', version: '8.9'
}
apply plugin: 'javafx-gradle-plugin'


jfx {
    appName = 'StudentManager'
    vendor = 'shaheen'
    // minimal requirement for jfxJar-task
    mainClass = "Main.Launcher"
}

any tips, suggestions, samples, would be good, thank you

1

1 Answers

1
votes

The javafx-maven-plugin and javafx-gradle-plugin share the same underlying tool: the javapackager (previous known as javafxpackager) so all restrictions apply to these build-tool plugins.

When creating the native installer, a installer-script has to be used (.iss-file for InnoSetup, .wxs-file for WiX), therefor some internal stored preset is processed for this: - for Inno Setup: https://github.com/teamfx/openjfx-8u-dev-rt/blob/master/modules/fxpackager/src/main/resources/com/oracle/tools/packager/windows/template.iss - for WiX: https://github.com/teamfx/openjfx-8u-dev-rt/blob/master/modules/fxpackager/src/main/resources/com/oracle/tools/packager/windows/template.wxs

While the process of copying some files and creating the installer, special strings are replaced within these templates. To have this file being picked up while running the build-tool plugin, you have to store some iss/wxs-file at src/main/deploy/windows/{appname}.iss/.wxs, where {appname} is your project-specified "appName" (on gradle its mostly the root project name, on maven this defaults to artifactId-version, but can be overriden by appName-configuration). This works because there is a special "drop-in replacement"-mechanism used inside the javapackager.

To have a prepared/processed file, you have to set verbose to true (inside the jfx-block when using gradle and inside the configuration of the plugin when using maven), then all used files will be preserved inside the %TEMP%-folder.

If there is anything needed further, please comment this and I will add this to the answer.

Disclaimer: I'm the maintainer of the javafx-maven-plugin and creator of the javafx-gradle-plugin.