JavaFx application with Maven in Eclipse

I want to ask if there is any method to add Java Fx to the Archetype Maven list in Eclipse or any plugin to use Maven to create a JavaFx application.

+7
maven javafx maven-3 javafx-2 javafx-8
source share
3 answers

There is a javafx-maven-plugin that is available for maven.

When developing using Java 8, you simply add this plugin as some kind of build plugin without additional 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 javafx-application-jar inside target/jfx/app/yourapp-jfx.jar or even creates its own launch (for example, an EXE file) when calling mvn jfx:native .

Disclaimer: I support javafx-maven-plugin.

+12
source share

The only thing I add to my pom.xml to build the JavaFX application is the 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> 

This is just the choice of javafx jar in my Java8 JRE to add it to the project. Then I use maven-assembly-plugin to build the flag with dependencies.

Hope this helps.

+3
source share

just like a normal Java application, because the JavaFX version bounced to 8.0. JavaFX support is built-in.

  <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.6.0</version> <executions> <execution> <id>run application</id> <phase>package</phase> <goals> <goal>java</goal> </goals> <configuration> <mainClass>cn.keepfight.intro.FXParamApp</mainClass> <arguments> <!--<argument>-Dsun.java2d.opengl=true</argument>--> </arguments> </configuration> </execution> </executions> </plugin> 
0
source share

All Articles