JavaFX 11 has just been released! You can get the latest release and find more documentation about it at https://openjfx.io.
Java 11 is just around the corner too. In order to prepare yourself for what's coming here are the first details on modifying your Maven and Gradle builds to compile and run your Griffon project.
Maven
- Make sure to have the latest Maven version installed. The current version is 3.5.4.
- Edit the
pom.xml
file and add a couple of additional properties<plugin.compiler.version>3.8.0</plugin.compiler.version> <javafx.version>11</javafx.version>
- Add the following dependencies to the
<dependencies>
block<dependency> <groupId>org.openjfx</groupId> <artifactId>javafx-base</artifactId> <version>${javafx.version}</version> </dependency> <dependency> <groupId>org.openjfx</groupId> <artifactId>javafx-graphics</artifactId> <version>${javafx.version}</version> </dependency> <dependency> <groupId>org.openjfx</groupId> <artifactId>javafx-controls</artifactId> <version>${javafx.version}</version> </dependency> <dependency> <groupId>org.openjfx</groupId> <artifactId>javafx-fxml</artifactId> <version>${javafx.version}</version> </dependency> <dependency> <groupId>javax.annotation</groupId> <artifactId>javax.annotation-api</artifactId> <version>1.3.2</version> </dependency>
- Install a release of Java 11 (currently still in Early Access) from http://jdk.java.net/11.
- Remove the usage of the
maven-javafx-plugin
as it won't work with JavaFX 11 or greater. - Launch the application by invoking
mvn -Prun
.
Gradle
- Make sure to have at least Gradle 4.10 installed.
- Edit the build.gradle file and add the
osdetector-gradle-plugin
to thebuildscript
orplugins
block.buildscript { repositories { maven { url 'https://plugins.gradle.org/m2/' } } dependencies { classpath 'com.google.gradle:osdetector-gradle-plugin:1.6.0' } } apply plugin: 'com.google.osdetector'
- Define a project variable with the resolved platform. Note that
ossdetector
identifies MacOSX asosx
but the JavaFX artifacts requiremac
.ext.platform = osdetector.os != 'osx' ? osdetector.os : 'mac'
- Comment out (or delete) the uses of the
javafx-plugin.gradle
file and thejfx
block. - Add the following dependencies to the
dependencies
blockcompile "org.openjfx:javafx-base:11:${platform}" compile "org.openjfx:javafx-graphics:11:${platform}" compile "org.openjfx:javafx-controls:11:${platform}" compile "org.openjfx:javafx-fxml:11:${platform}" compile 'javax.annotation:javax.annotation-api:1.3.2'
- Launch the application by invoking
gradle run
.
Deployment
Neither Maven nor Gradle have an answer to packaging an application with the javapackager
for now, as it has been removed from Oracle JDK 11 and it's not distributed with JavaFX 11. This being said Gluon is working on a temporary solution until JDK-8200758 is resolved