title: Build JavaFX 8 with Maven
body: <p>I tested to create JavaFX 8 project with Netbeans 7.4. But unfortunately with no luck. This is the POM file:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;com.dx57dc&lt;/groupId&gt;
      &lt;artifactId&gt;JFX8M&lt;/artifactId&gt;
      &lt;version&gt;1.0&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
      &lt;name&gt;JFX8M&lt;/name&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;mainClass&gt;com.dx57dc.jfx8m.MainApp&lt;/mainClass&gt;
      &lt;/properties&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.8&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;unpack-dependencies&lt;/id&gt;
                          &lt;phase&gt;package&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;unpack-dependencies&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;excludeScope&gt;system&lt;/excludeScope&gt;
                              &lt;excludeGroupIds&gt;junit,org.mockito,org.hamcrest&lt;/excludeGroupIds&gt;
                              &lt;outputDirectory&gt;${project.build.directory}/classes&lt;/outputDirectory&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                  &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;1.2.1&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;unpack-dependencies&lt;/id&gt;
  
                          &lt;phase&gt;package&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;exec&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;executable&gt;${java.home}/../bin/javafxpackager&lt;/executable&gt;
                              &lt;arguments&gt;
                                  &lt;argument&gt;-createjar&lt;/argument&gt;
                                  &lt;argument&gt;-nocss2bin&lt;/argument&gt;
                                  &lt;argument&gt;-appclass&lt;/argument&gt;
                                  &lt;argument&gt;${mainClass}&lt;/argument&gt;
                                  &lt;argument&gt;-srcdir&lt;/argument&gt;
                                  &lt;argument&gt;${project.build.directory}/classes&lt;/argument&gt;
                                  &lt;argument&gt;-outdir&lt;/argument&gt;
                                  &lt;argument&gt;${project.build.directory}&lt;/argument&gt;
                                  &lt;argument&gt;-outfile&lt;/argument&gt;
                                  &lt;argument&gt;${project.build.finalName}.jar&lt;/argument&gt;
                              &lt;/arguments&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;  
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.8&lt;/source&gt;
                      &lt;target&gt;1.8&lt;/target&gt;
                      &lt;compilerArguments&gt;
                          &lt;bootclasspath&gt;${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar&lt;/bootclasspath&gt;
                      &lt;/compilerArguments&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>When I compile the jar file run it with Netbeans 7.3.1 I get this error:</p>
  
  <pre><code>Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (unpack-dependencies) on project JFX8M: Command execution failed. Cannot run program "C:\Program Files\Java\jdk1.8.0\jre\..\bin\javafxpackager" (in directory "D:\Documents and Settings\pterzie\My Documents\NetBeansProjects\JFX8M"): CreateProcess error=14001, This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem -&gt; [Help 1]
  </code></pre>
  
  <p>When I compile the project and run it on Netbeans 7.4 I get this error stack:</p>
  
  <pre><code>Executing command line: C:\Program Files\Java\jdk1.8.0\jre\..\bin\javafxpackager -createjar -nocss2bin -appclass com.dx57dc.jfx8m.MainApp -srcdir D:\Documents and Settings\pterzie\My Documents\NetBeansProjects\JFX8M\target/classes -outdir D:\Documents and Settings\pterzie\My Documents\NetBeansProjects\JFX8M\target -outfile JFX8M-1.0.jar
  ------------------------------------------------------------------------
  BUILD FAILURE
  ------------------------------------------------------------------------
  Total time: 2.782s
  Finished at: Sat Aug 03 13:25:30 PDT 2013
  Final Memory: 14M/34M
  ------------------------------------------------------------------------
  Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (unpack-dependencies) on project JFX8M: Command execution failed. Cannot run program "C:\Program Files\Java\jdk1.8.0\jre\..\bin\javafxpackager" (in directory "D:\Documents and Settings\pterzie\My Documents\NetBeansProjects\JFX8M"): CreateProcess error=14001, This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem -&gt; [Help 1]
  org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (unpack-dependencies) on project JFX8M: Command execution failed.
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:491)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
  Caused by: org.apache.maven.plugin.MojoExecutionException: Command execution failed.
      at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:367)
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
      ... 19 more
  Caused by: java.io.IOException: Cannot run program "C:\Program Files\Java\jdk1.8.0\jre\..\bin\javafxpackager" (in directory "D:\Documents and Settings\pterzie\My Documents\NetBeansProjects\JFX8M"): CreateProcess error=14001, This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem
      at java.lang.ProcessBuilder.start(ProcessBuilder.java:1043)
      at java.lang.Runtime.exec(Runtime.java:620)
      at org.apache.commons.exec.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)
      at org.apache.commons.exec.DefaultExecutor.launch(DefaultExecutor.java:254)
      at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:319)
      at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160)
      at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:610)
      at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:352)
      ... 21 more
  Caused by: java.io.IOException: CreateProcess error=14001, This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem
      at java.lang.ProcessImpl.create(Native Method)
      at java.lang.ProcessImpl.&lt;init&gt;(ProcessImpl.java:386)
      at java.lang.ProcessImpl.start(ProcessImpl.java:137)
      at java.lang.ProcessBuilder.start(ProcessBuilder.java:1024)
      ... 28 more
  </code></pre>
  
  <p>Is there any example with Java 8 and Maven which is implemented and working properly?</p>
  
  <p><em><strong>P.S</em></strong>
  I managed to make it working after I remove a plugin. I edited the POM this way:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;com.dx57dc&lt;/groupId&gt;
      &lt;artifactId&gt;JFX8M&lt;/artifactId&gt;
      &lt;version&gt;1.0&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
      &lt;name&gt;JFX8M&lt;/name&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;mainClass&gt;&lt;/mainClass&gt;
      &lt;/properties&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.8&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;unpack-dependencies&lt;/id&gt;
                          &lt;phase&gt;package&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;unpack-dependencies&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;excludeScope&gt;system&lt;/excludeScope&gt;
                              &lt;excludeGroupIds&gt;junit,org.mockito,org.hamcrest&lt;/excludeGroupIds&gt;
                              &lt;outputDirectory&gt;${project.build.directory}/classes&lt;/outputDirectory&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;com.zenjava&lt;/groupId&gt;
                  &lt;artifactId&gt;javafx-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.0&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;mainClass&gt;com.dx57dc.jfx8m.MainApp&lt;/mainClass&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.8&lt;/source&gt;
                      &lt;target&gt;1.8&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>It works only for JVM 8. Am I missing something important into the POM file?</p>