Senior
What is a Fat JAR?
sobes.tech AI
Answer from AI
A Fat JAR is an executable JAR file in Java that contains not only the compiled application code but also all necessary dependencies (libraries) within a single archive. This simplifies distribution and execution of the application, as there is no need to manage external libraries separately.
Advantages of Fat JAR:
- Deployment convenience: only one file is needed.
- Dependency isolation: no conflicts with other library versions.
Disadvantages:
- The file size is significantly larger than a regular JAR.
- When updating a library, the entire JAR needs to be rebuilt.
An example of creating a Fat JAR using the Maven plugin maven-shade-plugin allows bundling all dependencies into one file.