title: Is javafx-maven-plugin required for shiping a javafx application after JDK11?
body: <p>I'm trying to figure out <strong>what would be the minimum <code>pom.xml</code></strong> to use for creating a <strong>hello-world javafx application</strong> that can be provided to the client as a <code>jar</code> + <code>./lib</code> and run with <code>java -jar</code>.</p>
  <p>I've used:</p>
  <p><strong>pom.xml</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;com.example.javafx&lt;/groupId&gt;
      &lt;artifactId&gt;javafx-jdk14-example&lt;/artifactId&gt;
      &lt;version&gt;1.0.0&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;maven.compiler.source&gt;14&lt;/maven.compiler.source&gt;
          &lt;maven.compiler.target&gt;14&lt;/maven.compiler.target&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-jar-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.2.0&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;archive&gt;
                          &lt;manifest&gt;
                              &lt;addClasspath&gt;true&lt;/addClasspath&gt;
                              &lt;classpathPrefix&gt;lib/&lt;/classpathPrefix&gt;
                              &lt;mainClass&gt;com.example.javafx.app.Main&lt;/mainClass&gt;
                          &lt;/manifest&gt;
                      &lt;/archive&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&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;3.1.1&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;copy-dependencies&lt;/id&gt;
                          &lt;phase&gt;package&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;copy-dependencies&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;outputDirectory&gt;${project.build.directory}/lib&lt;/outputDirectory&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.openjfx&lt;/groupId&gt;
              &lt;artifactId&gt;javafx-controls&lt;/artifactId&gt;
              &lt;version&gt;14&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.openjfx&lt;/groupId&gt;
              &lt;artifactId&gt;javafx-graphics &lt;/artifactId&gt;
              &lt;version&gt;14&lt;/version&gt;
              &lt;classifier&gt;linux&lt;/classifier&gt;
          &lt;/dependency&gt;        
      &lt;/dependencies&gt;    
  &lt;/project&gt;
  </code></pre>
  <p><strong>Main.java</strong></p>
  <pre><code>package com.example.javafx.app;
  
  import javafx.application.Application;
  import javafx.geometry.Pos;
  import javafx.scene.Scene;
  import javafx.scene.control.Button;
  import javafx.scene.layout.GridPane;
  import javafx.stage.Stage;
   
  public class Main extends Application {
      public static void main(String[] args) {
          launch(args);
      }
      
      @Override
      public void start(Stage primaryStage) {
          GridPane grid = new GridPane();
          grid.setAlignment(Pos.CENTER);  // Override default
          grid.setHgap(10);
          grid.setVgap(12);        
          
          Button btn = new Button();
  
          
          btn.setText(&quot;Clickme&quot;);
          btn.setOnAction((t) -&gt; System.out.println(&quot;Clicked!&quot;));
          
          grid.add(btn, 0, 0);
          primaryStage.setScene(new Scene(grid, 640, 480));
          primaryStage.show();
      }
  }
  </code></pre>
  <p>Note that <strong>I don't use a <code>module-info.java</code> on my app.</strong></p>
  <p>But when I run it:</p>
  <pre class="lang-sh prettyprint-override"><code>mvn clean package
  cd target
  /jdk14/bin/java -jar javafx-jdk14-example-1.0.0.jar
  </code></pre>
  <p>I get:</p>
  <blockquote>
  <p>Error: JavaFX runtime components are missing, and are required to run this application</p>
  </blockquote>
  <p>If I use the same with JDK10 (also <code>compiler.source/target=10</code> and comment-out <code>org.openjfx</code> deps) then the above works fine.</p>
  <p>Is there any other way (on JDK11+) to build and then be able to run the application from inside target directory without requiring to use <code>javafx-maven-plugin</code> ?</p>