javafx application in maven project

java, javafx-2, maven-3

Solution

So I guess you already use Java 7, I d'ont know exactly what you need, for compiling you will need only the dependency to javafx, so in your pom for the javafx app:

<dependencies>
    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>javafx</artifactId>
        <version>2.0</version>
        <systemPath>${javafx.rt.jar}</systemPath>
        <scope>system</scope>
    </dependency>
</dependencies>

And in your maven settings.xml add (and adapt path to your system):

<profile>
  <id>javafx</id>
  <activation>
    <activeByDefault>true</activeByDefault>
  </activation>
  <properties>
    <javafx.rt.jar>C:\Program Files (x86)\Oracle\JavaFX 2.0 SDK\rt\lib\jfxrt.jar</javafx.rt.jar>
    <ant.javafx.jar>C:\Program Files (x86)\Oracle\JavaFX 2.0 SDK\tools\ant-javafx.jar</ant.javafx.jar>
  </properties>
</profile>

It should be enough to compile and make jar file... If not tell me and I'll post more info...

Problem

I have a project with structure like this: main-project -libary-1 -library-2 -i-need-javafx-app-here So, i need a JavaFX 2 application in my maven project, and it should use library-1 and library-2 with its dependencies. I can't find any maven archetypes for JavaFX 2 projects and i cand find any adequate information about how i can build JavaFX app by Maven 3. I don't need any deployment to web, it will only desktop app. So, can anybody help with this problem? UPD: `java.lang.NoClassDefFoundError: javafx/application/Application ... Caused by: java.lang.ClassNotFoundException: javafx.application.Application` exception is occured when i try to run application, which is builded by pgras way.

Original source

Related problems