The Gradle docs: New javafx plugin

Sverre Moe sverre.moe at gmail.com
Mon Dec 3 18:47:19 UTC 2018


I noticed the tutorial on building JavaFX 11 with Gradle has changed.
https://openjfx.io/openjfx-docs/#gradle

A new plugin has emerged: https://github.com/openjfx/javafx-gradle-plugin
id 'org.openjfx.javafxplugin' version '0.0.5'

javafx {
    modules = [ 'javafx.controls' ]
}

The guide should mention how to set a specific JavaFX version to use.
It seems the plugin has hard coded version to 11.0.1, but this can be
changed by setting the version variable. I had to look into the source code
to find this.
javafx {
    version = "11.0.+"

    modules = [
        'javafx.graphics',
        'javafx.controls',
        'javafx.media',
        'javafx.web',
        'javafx.fxml'
    ]
}

Previously this was the setup used in the tutorial before this new plugin:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath group: 'com.google.gradle', name:
'osdetector-gradle-plugin', version: '1.6.0'
    }
}

ext {
    platform = osdetector.os == 'osx' ? 'mac' : osdetector.os == 'windows'
? 'win' : osdetector.os
}

dependencies {
    compile group: 'org.openjfx', name: "javafx-base", version: '11',
classifier: platform
}

I have previously been using the moduleplugin to get module support on
Gradle. Seems this new javafx plugin does the same thing. It work similar
without the moduleplugin. Though the moduleplugin could be used for
non-javafx module projects.
id "org.javamodularity.moduleplugin" version "1.2.1"

However neither of these plugins work with Javadoc task when having Log4j
as a dependency. Same error on both:
module-info.java:12: error: module not found: org.apache.logging.log4j


Could it be possible to expand this new plugin later to incorporate
JLink/JPackager for building a runtime image and installers with JavaFX.
There is an older JavaFX plugin used for building with JavaFX 8 and package
using javapackager.
https://github.com/FibreFoX/javafx-gradle-plugin

/Sverre


More information about the openjfx-discuss mailing list