FEST: new JavaFX Maven plugin

by Алекс Руис on December 9, 2009

I’m back to working on FEST-JavaFX, an open source library for functional testing of JavaFX GUIs. To keep consistency with the rest of FEST modules, I decided to use Maven to compile and build the project.

I blogged some time ago how to compile JavaFX code with Maven. I wasn’t too happy with it, since it was verbose and I’d have to copy/paste the Ant build for every JavaFX project. I found JFrog’s JavaFX Maven plugin and gave it a try. Although configuration was easy, I couldn’t make it work.

The plugin expects the JavaFX jars to be installed in a local Maven repository. This is something that I don’t agree with, for the following reasons:

  • I don’t see the point of having JavaFX jars in a Maven repository, since those jars cannot be distributed (per JavaFX’s license)
  • Installing those jars in a local repository is easy but time-consuming: it needs to be done one by one
  • So far, with each release, the number and some of the names of JavaFX jars change; I wouldn’t want to go through the process of installing them in a local repository every time there is a JavaFX release

Since Maven already supports creating plugins based on Ant, I just had to wrap my existing Ant script with a Maven plugin.

Creating the plugin was really easy, it took no more than 10 minutes. Maven’s documentation and online book are pretty good and they helped me a lot.

The main difference between FEST’s JavaFX Maven plugin and JFrog’s is that FEST’s does not require the JavaFX jars to be installed in a local repository. Instead, it uses an environment variable, JAVAFX_HOME, to locate the path of the JavaFX jars.

I just released version 0.1. Since it is a Maven plugin, I don’t think it is necessary to add a distribution file to the “downloads” page. The plugin can be obtained from our Maven repository.

The following example shows how to use the plugin to compile JavaFX source when the standard “compile” goal is executed:

<build>
  <plugins>
    <plugin>
      <groupId>org.easytesting</groupId>
      <artifactId>fest-javafx-maven</artifactId>
      <version>0.1</version>
      <executions>
        <execution>
          <phase>compile</phase>
          <goals>
            <goal>desktopCompile</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

Please note that it is not necessary to specify the JavaFX jars as project dependencies (at least I haven’t had to do it, so far.)

Currently the plugin has only one goal: “desktopCompile”, to compile JavaFX sources under the desktop profile. For more information about configuring the plugin, please visit the plugin’s homepage.

I originally created version 0.1 to satisfy the needs of the FEST-JavaFX project. There is a lot of room for improvement.

Please give the plugin a try. Feedback is always welcome! :)

As an additional note, the Silicon Valley JavaFX user’s group (SvJugFx) will be holding its first meeting, with a live streaming presentation from Richard Bair. The SvJugFx is organized by my good friend and FEST teammate Stephen Chin. See you there!

{ 3 comments… read them below or add one }

Darij December 11, 2009 at 6:41 am

is it possible to use your plugin with netbeans? Both with build and execute option?

Reply

Alex Ruiz December 11, 2009 at 11:42 am

I’m not a Netbeans user, but I’d think it would work. The plugin is not tied to any particular IDE.

-Alex

Reply

Darij December 16, 2009 at 12:54 am

Ok. What about the compilation of java and javafx? Some of the old plugins does not compile projects both consisting of java and fx files.
In fact, I’m new to Maven. And my work site is out-of-internet. They’re using local repository. I don’t know what offline jars needed for your plugin. If the question isn’t too specific, can you help?

Reply

Leave a Comment

{ 3 trackbacks }

Previous post:

Next post: