Search code examples
mavenjavafxjavafx-2maven-3javafx-8

JavaFX Application with Maven in Eclipse


I want to ask if there is any method to add JavaFX into Maven Archetype list in Eclipse or any plugin to use Maven to build JavaFX Application.


Solution

  • 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.