What are the differences between uberJar, fatJar and shadowJar in Gradle?

The terms are sometimes used interchangeably, but usually refers to:

  • Fat jar (also named Uber jar) – used to describe a jar that has all classes from dependent jars zipped directly inside it in the correct directory structure, and not in other jars. There is a good explanation here.

  • Shaded jar (or shaded classes) – usually refers to a process of changing classes bytecode to change packages names of the classes, and also modify were it is used in the jar. It is used to link classes to a specific version of other classes and avoid versions collisions. It can be created by Maven Shade Plugin. Shaded jar do not necessary contain all the dependencies needed.

The gradle shadow plugin can generate both fat jars and shaded jars, and same for the maven shaded plugin. I guess that is why people mix those terms.

Note: I have seen cases that refers to fat jar as a jar contains dependencies as a packed jars inside it.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)