Links

  • 1. Sogeti
  • 2. JBoss
  • 3. IBM
  • 4. Oracle
  • 5. SpringSource
  • 6. NL-JUG
  • 7. Java

Archives

Syndication  RSS 2.0

RSS 1.0
RSS 2.0

Bookmark this site

Add 'JCN Blog' site to delicious  Add 'JCN Blog' site to technorati  Add 'JCN Blog' site to digg  Add 'JCN Blog' site to dzone

Posted by Martijn van de Rijdt at 18:48 on Saturday 14 August    Add 'Building a JavaFX project with Maven' site to delicious  Add 'Building a JavaFX project with Maven' site to technorati  Add 'Building a JavaFX project with Maven' site to digg  Add 'Building a JavaFX project with Maven' site to dzone

JavaFX is a fairly new language, so I was curious to see if Maven plugins to build JavaFX projects were already available. After considering the FEST JavaFX Plugin and after a failed attempt to get the Plexus Compiler Component for javafxc working, I decided to try out the JFrog JavaFX Compiler Maven Plugin.

According to the site, I wouldn’t have to do much. Under the plugins tag in my pom I would need to add the following:

<plugin>
  <groupId>org.jfrog.maven.plugins</groupId>
  <artifactId>jfrog-javafx-plugin</artifactId>
  <executions>
    <execution>
      <goals>
        <goal>compile</goal>
      </goals>
    </execution>
  </executions>
</plugin>

Besides that, I would need to add a reference to the JFrog repository to either my settings.xml file or the project’s pom, in order to download the plugin itself. For this little experiment I decided to just add it to the pom. The instructions said I’d only need a reference to their plugins-releases-local repository, but this wasn’t enough; in order to have access to the JavaFX libraries themselves I also had to add their libs-releases-local repository. I ended up with the following profile:

<profiles>
  <profile>
    <id>default</id>
    <activation>
      <activeByDefault>true</activeByDefault>
    </activation>
    <repositories>
      <repository>
        <id>jfrog-libs-dist</id>
        <name>jfrog-libs-dist</name>
        <url>http://repo.jfrog.org/artifactory/libs-releases-local</url>
        <snapshots>
          <enabled>false</enabled>
        </snapshots>
      </repository>
    </repositories>
    <pluginRepositories>
      <pluginRepository>
        <id>jfrog-plugins-dist</id>
        <name>jfrog-plugins-dist</name>
        <url>http://repo.jfrog.org/artifactory/plugins-releases-local</url>
        <snapshots>
          <enabled>false</enabled>
        </snapshots>
      </pluginRepository>
      <pluginRepository>
        <id>jfrog-libs-dist</id>
        <name>jfrog-libs-dist</name>
        <url>http://repo.jfrog.org/artifactory/libs-releases-local</url>
        <snapshots>
          <enabled>false</enabled>
        </snapshots>
      </pluginRepository>
    </pluginRepositories>
  </profile>
</profiles>

Finally, in order to compile everything, of course I would also need to add a dependency for the JavaFX runtime. The site explains how to do this for JavaFX 1.1.1, but I wanted to use JavaFX 1.3.0. Since version 1.1.1, the JavaFX runtime has been split up into a bunch of different jars, such as javafx-common, javafx-anim, javafx-ui-desktop, et cetera. Of course you can add a dependency only for those JavaFX jars you actually need, but I was lazy and just added the following:

<dependency>
  <groupId>javafx</groupId>
  <artifactId>all-sdk</artifactId>
  <version>1.3.0</version>
</dependency>

The all-sdk pom contains dependencies of all actual JavaFX 1.3.0 jars, so this will ensure you will be able to use the entirety of JavaFX in your project.

After I did all that, the project built successfully!


© 2018 Java Competence Network. All Rights Reserved.