title: JavaFX packaging: NoClassDefFoundError
body: <p>I package a JavaFX application using maven and OpenJDK 1.8
  The relevant part from my pom.xml:</p>
  
  <pre><code>&lt;plugin&gt;
      &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
      &lt;executions&gt;
          &lt;execution&gt;
              &lt;phase&gt;package&lt;/phase&gt;
              &lt;goals&gt;
                  &lt;goal&gt;single&lt;/goal&gt;
              &lt;/goals&gt;
          &lt;/execution&gt;
      &lt;/executions&gt;
      &lt;configuration&gt;
          &lt;archive&gt;
              &lt;manifest&gt;
                  &lt;addClasspath&gt;true&lt;/addClasspath&gt;
                  &lt;mainClass&gt;ui.Main&lt;/mainClass&gt;
              &lt;/manifest&gt;
          &lt;/archive&gt;
          &lt;descriptorRefs&gt;
              &lt;descriptorRef&gt;jar-with-dependencies&lt;/descriptorRef&gt;
          &lt;/descriptorRefs&gt;
      &lt;/configuration&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>Now importantly <strong>this used to work</strong>. I know this because I specifically made a git commit where the packaging finally worked.
  After a day or so and multiple builds like this (I can't figure out what changed), I can no longer launch the jar because of the following error:</p>
  
  <pre><code>$ java -jar target/app.jar
  Error: Could not find or load main class ui.Main Caused by:
  java.lang.NoClassDefFoundError: javafx/application/Application
  </code></pre>
  
  <p>When I view the contents of the Jar, I can see that all dependencies are specifically included, except the JavaFX classes.</p>
  
  <p>What I've tried:</p>
  
  <ul>
  <li>Build the jar with <code>javapackager</code></li>
  <li>Tinker around with the javafx-maven-plugin</li>
  <li>Explicitly add JavaFX as dependency in my pom.xml in the hopes that the assembly-plugin would package it for me</li>
  </ul>
  
  <p>None of the above was successful. The only way I'm able to launch my app is directly out of the IDE, which seems to mean that the JavaFX libs <em>are</em> still available on my system.</p>
  
  <p>Any ideas on how to get this to run (again)?</p>