Created
October 20, 2021 20:55
-
-
Save krissrex/9eac69bbe76303c2b54d1d8400368606 to your computer and use it in GitHub Desktop.
Create an executable fat jar with maven
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-shade-plugin</artifactId> | |
<version>3.2.4</version> | |
<executions> | |
<execution> | |
<phase>package</phase> | |
<goals> | |
<goal>shade</goal> | |
</goals> | |
<configuration> | |
<transformers> | |
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> | |
<mainClass>no.krex.jfxdemo.HelloApplicationKt</mainClass> | |
</transformer> | |
</transformers> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
<plugin> | |
<groupId>org.codehaus.mojo</groupId> | |
<artifactId>exec-maven-plugin</artifactId> | |
<version>3.0.0</version> | |
<executions> | |
<execution> | |
<phase>package</phase> | |
<goals> | |
<goal>exec</goal> | |
</goals> | |
</execution> | |
</executions> | |
<configuration> | |
<executable>sh</executable> | |
<arguments> | |
<argument>-c</argument> | |
<argument>echo "$SHEBANGHEADER" | cat - target/jfx-demo-1.0-SNAPSHOT.jar > target/executable-jfx-demo-1.0-SNAPSHOT.jar</argument> | |
</arguments> | |
<environmentVariables> | |
<SHEBANGHEADER>#!/bin/sh | |
exec java -jar $0 "$@" > /dev/null | |
</SHEBANGHEADER> | |
</environmentVariables> | |
</configuration> | |
</plugin> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment