From 097f8feb1261fe79090d8d7251df83f754b18cf0 Mon Sep 17 00:00:00 2001 From: kske Date: Sun, 5 Jul 2020 16:11:00 +0200 Subject: [PATCH] Fix fat JAR generation * Replace Maven Assembly Plugin with Maven Shade Plugin * Extract main method to separate Main class --- pom.xml | 21 ++++++++------- src/main/java/envoy/client/Main.java | 30 ++++++++++++++++++++++ src/main/java/envoy/client/ui/Startup.java | 9 ------- 3 files changed, 40 insertions(+), 20 deletions(-) create mode 100644 src/main/java/envoy/client/Main.java diff --git a/pom.xml b/pom.xml index d036d0d..6411314 100644 --- a/pom.xml +++ b/pom.xml @@ -61,23 +61,22 @@ org.apache.maven.plugins - maven-assembly-plugin - 3.2.0 + maven-shade-plugin + 3.2.4 package - single + shade - - - envoy.client.ui.Startup - - - - jar-with-dependencies - + true + envoy + + + envoy.client.Main + + diff --git a/src/main/java/envoy/client/Main.java b/src/main/java/envoy/client/Main.java new file mode 100644 index 0000000..57f2d6d --- /dev/null +++ b/src/main/java/envoy/client/Main.java @@ -0,0 +1,30 @@ +package envoy.client; + +import javafx.application.Application; + +import envoy.client.ui.Startup; + +/** + * Triggers application startup. + *

+ * To allow Maven shading, the main method has to be separated from the + * {@link Startup} class which extends {@link Application}. + *

+ * Project: envoy-client
+ * File: Main.java
+ * Created: 05.07.2020
+ * + * @author Kai S. K. Engelbart + * @since Envoy Client v0.1-beta + */ +public class Main { + + /** + * Starts the application. + * + * @param args the command line arguments are processed by the + * client configuration + * @since Envoy Client v0.1-beta + */ + public static void main(String[] args) { Application.launch(Startup.class, args); } +} diff --git a/src/main/java/envoy/client/ui/Startup.java b/src/main/java/envoy/client/ui/Startup.java index f57b22e..c505f33 100644 --- a/src/main/java/envoy/client/ui/Startup.java +++ b/src/main/java/envoy/client/ui/Startup.java @@ -128,13 +128,4 @@ public final class Startup extends Application { logger.log(Level.SEVERE, "Unable to save local files: ", e); } } - - /** - * Starts the application. - * - * @param args the command line arguments are processed by the - * {@link ClientConfig} - * @since Envoy Client v0.1-beta - */ - public static void main(String[] args) { launch(args); } }