JavaFX Application with Maven in Eclipse

The only thing I add to my pom.xml in order to build JavaFX Application is this dependency :

<dependency>
        <groupId>com.oracle</groupId>
        <artifactId>javafx</artifactId>
        <version>2.2</version>
        <systemPath>${java.home}/lib/ext/jfxrt.jar</systemPath>
        <scope>system</scope>
</dependency>

It is simply fetching the javafx jar in my Java8 JRE to add it to the project. Then I use the maven-assembly-plugin to build the jar with dependencies.

Hope it helps.


There is the javafx-maven-plugin which is available for maven.

When developing with Java 8 you just put that plugin as some build-plugin, without further dependencies.

<plugin>
    <groupId>com.zenjava</groupId>
    <artifactId>javafx-maven-plugin</artifactId>
    <version>8.8.3</version>
    <configuration>
        <mainClass>your.main.class.which.extends.javafx.Application</mainClass>
    </configuration>
</plugin>

Calling mvn jfx:jar creates your javafx-application-jar inside target/jfx/app/yourapp-jfx.jar, or even creates native launcher (like EXE-file) when calling mvn jfx:native.

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