Plexus Compiler Component for javafxc (OpenJFX Compiler) / Updated 2009-07-28

What's New

JavaFX and JavaFX SDK were both released (current version of SDK is 1.2). The earlier version of the component (0.1) would not work with the final version of the products, so the component was changed to support final version of the compiler and SDK. Currently executing javafxc from command line results in complicated building a long chain of classpath elements and command line arguments and then calling com.sun.tools.javafx.Main. Thus, in version 0.3 only forked execution of compiler is supported (in version 0.1 both were supported and forked execution was not recommended). Good news is that you need not to specify dependencies on parts of JavaFX runtime (runtime.jar, scenario.jar, etc.), the component simply invokes javafxc as if it were invoked manually from command line. If you use old version you will need to managed dependencies manually (putting them into the local repository and so on). That's we strongly recommend to use version 0.3. If by any reason you would like to use 0.1 the previous version of this page is here. The artifact is now in Maven Central Repository and, thus, you need not use SF-hosted repository. WARNING: Version 0.2 is defunct, however you may find it in Maven Central Repository.

Basic usage

You can build your JavaFX sources with Maven 2 using standard “maven-compiler-plugin”.

Put something similar in <build> section of POM file:

  <build>
      <sourceDirectory>src/main/fx</sourceDirectory>
      ...
      <plugins>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              <configuration>
                  <compilerId>javafxc</compilerId>
                  <include>**/*.fx</include>
                  <fork>true</fork> <!-- NOTE: only “fork” mode supported now -->
              </configuration>
              <dependencies>                
                  <dependency>
                      <groupId>net.sf.m2-javafxc</groupId> <!-- NOTE: groupdId conforms project domain name, was: net.sf.m2-javafxc -->
                      <artifactId>plexus-compiler-javafxc</artifactId>
                      <version>0.3</version> <!-- NOTE: 0.3 is the current version in Maven Central repository -->
                  </dependency>
              </dependencies>
          </plugin>
      </plugins>
      ...
  </build>

Make sure you have $JFX_HOME environment variable set.

For Windows users: JavaFX SDK should not be installed into location which path contains spaces (or other tokens that need escaping), please, no C:\Program Files !

Diagnostic

Sometimes it is hard to understand if the component fetches JavaFX SKD correctly or not... Use -X and -e option to understand what happens.

That is all

If you have any suggestions, ideas or want to contribute, mail list is: m2-javafxc-develop@lists.sourceforge.net (archive http://sourceforge.net/mailarchive/forum.php?forum_name=m2-javafxc-develop). Thank you!

Happy coding! :)

SourceForge.net Logo