Merge pull request #176 from informatik-ag-ngl/f/maven_shading

Fix Fat JAR Generation
This commit is contained in:
Kai S. K. Engelbart 2020-07-05 20:27:44 +00:00 committed by GitHub
commit 6a1bdc5fbb
3 changed files with 53 additions and 20 deletions

34
pom.xml
View File

@ -40,6 +40,18 @@
<artifactId>javafx-fxml</artifactId> <artifactId>javafx-fxml</artifactId>
<version>11.0.2</version> <version>11.0.2</version>
</dependency> </dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics </artifactId>
<version>11</version>
<classifier>win</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics </artifactId>
<version>11</version>
<classifier>linux</classifier>
</dependency>
</dependencies> </dependencies>
<build> <build>
@ -61,23 +73,23 @@
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.2.0</version> <version>3.2.4</version>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>package</phase>
<goals> <goals>
<goal>single</goal> <goal>shade</goal>
</goals> </goals>
<configuration> <configuration>
<archive> <shadedArtifactAttached>true</shadedArtifactAttached>
<manifest> <sharedClassifierName>envoy</sharedClassifierName>
<mainClass>envoy.client.ui.Startup</mainClass> <transformers>
</manifest> <transformer
</archive> implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<descriptorRefs> <mainClass>envoy.client.Main</mainClass>
<descriptorRef>jar-with-dependencies</descriptorRef> </transformer>
</descriptorRefs> </transformers>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>

View File

@ -0,0 +1,30 @@
package envoy.client;
import javafx.application.Application;
import envoy.client.ui.Startup;
/**
* Triggers application startup.
* <p>
* To allow Maven shading, the main method has to be separated from the
* {@link Startup} class which extends {@link Application}.
* <p>
* Project: <strong>envoy-client</strong><br>
* File: <strong>Main.java</strong><br>
* Created: <strong>05.07.2020</strong><br>
*
* @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); }
}

View File

@ -128,13 +128,4 @@ public final class Startup extends Application {
logger.log(Level.SEVERE, "Unable to save local files: ", e); 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); }
} }