Martin
11/25/2024, 9:20 AMMartin
11/25/2024, 9:21 AMMartin
11/25/2024, 9:22 AMMartin
11/25/2024, 9:22 AMGabriel Ittner
11/25/2024, 9:50 AMvierbergenlars
11/25/2024, 9:50 AMMartin
11/25/2024, 9:54 AMto hide partly by or as if by a shadow
to shelter or screen by intercepting radiated light or heat
Shadow: https://www.merriam-webster.com/dictionary/shadow#dictionary-entry-2
to cast a shadow upon
to accompany and observe especially in a professional setting
Martin
11/25/2024, 9:55 AMMartin
11/25/2024, 9:56 AMOver here, we call it either a shaded jar or a fat jar.fat jar doesn't say anything about relocation. You can make a fat jar by embedding all the jars. I prefer "shaded jar"
Martin
11/25/2024, 9:58 AMthat comes from the Maven plugin with the same nameAh good catch! Maven is "Maven Shade Plugin", Gradle is "Gradle Shadow Plugin"
Vampire
11/25/2024, 10:44 AMfat jar doesn't say anything about relocation. You can make a fat jar by embedding all the jars. I prefer "shaded jar"For me that difference is "bad practice fat jar" (repacked dependencies) vs. "good practice fat jar" (spring boot jar way) 🙂
Martin
11/25/2024, 10:47 AMVampire
11/25/2024, 10:56 AMMartin
11/25/2024, 12:52 PMjava -jar cli.jar
Martin
11/25/2024, 12:53 PMVampire
11/25/2024, 12:59 PM./cli
.
Especially when in the future you might need additional things like determining the current directory to be able to have some configuration file, or also if java
is not in the PATH
but JAVA_HOME
is properly defined, or when using jlink
to generate a minimal JRE and ship it together with the distribution, ...
All that is quite hard or impossible to do when using java -jar cli.jar
, or at that point the users have to re-adjust how they call the CLI. 🙂
Theoretically, you can still use java -jar cli.jar
when you use Class-Path
attributes in the manifest, of course you would still ship an archive that needs to be unpacked first.
And if it just for the simplicity of using java -jar cli.jar
, you could as well use the good-practice fat jar, i.e. the way Spring Boot JARs work, by packing the full JARs as-are into your JAR and having a classloader that loads the classes from there.Martin
11/25/2024, 1:08 PM