Adam Bien's Weblog
How To Compile Java FX 2 Applications With Maven 3
Java FX 2 is Java. To build a Java FX application you only need an additional JAR: jfxrt.jar which contains the Java FX UI classes. The JAR comes with Java FX SDK, but is not included in the public maven repository. You can point to the Java FX SDK installation with Maven's system scope dependency:
<project>
...
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>javafx</artifactId>
<version>2.0</version>
<systemPath>${fx.home}/rt/lib/jfxrt.jar</systemPath>
<scope>system</scope>
</dependency>
</dependencies>
</project>
The resolution of the ${fx.home} variable ensures the pom.xml independency on user-specific settings:
<settings>
...
<profiles>
<profile>
<id>javafx</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<fx.home>[PATH]/javafx-sdk2.1.0-beta/</fx.home>
</properties>
</profile>
</profiles>
</settings>
Posted at 09:01AM Dec 21, 2011 by Adam Bien in RIA / Java FX | Comments[0] | Views/Hits: 2944
*NEW* Workshop: "Real World Java EE 6/7 Bootstrap" and book: Real World Java EE Night Hacks--Dissecting the Business Tier Tweet Follow @AdamBien


