You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this is to demonstrate how to create a java jar that has all dependencies and can be executed on multiple platforms.
4
+
5
+
Leverages:
6
+
- Java 11 (non-module config)
7
+
- Maven
8
+
- javafx (with multiple OS specific dependencies)
9
+
- maven-shade-plugin
10
+
11
+
When importing into your IDE "Open" or "Import" the `pom.xml` file to create a new project.
12
+
13
+
Most of the interesting work is in the `pom.xml` file. Also, there is a funny situation that requires the use of a seperate class with a `main` method. See the comments in `FatJarLauncher.java`
14
+
15
+
execute maven (`mvn`) with the `package` goal then locate your jar in the `target/` dir.
16
+
17
+
mvn package
18
+
19
+
This little app is just a simple ui for [Bernardo-MG/dice-notation-java](https://github.com/Bernardo-MG/dice-notation-java). That lib has a handful of transitive dependencies so this demonstrates how `maven-shade-plugin` creates a jar with ALL the necessary dependencies.
20
+
21
+
A compiled version of this is over in the [Releases](https://github.com/danlangford/dice-notation-javafx/releases).
22
+
23
+
The only dependency that is not included in Java 11 itself. It is possible to include that but then you would not be using the shade plugin, you would be using all proper java modules and `jlink`. I'll demonstrate that another time.
0 commit comments