Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Uber JAR, in short, is a JAR containing everything.</p> <p>Normally in Maven, we rely on dependency management. An artifact contains only the classes/resources of itself. Maven will be responsible to find out all artifacts (JARs etc) that the project depending on when the project is built.</p> <p>An uber-jar is something that take all dependencies, and extract the content of the dependencies and put them with the classes/resources of the project itself, in one big JAR. By having such uber-jar, it is easy for execution, because you will need only one big JAR instead of tons of small JARs to run your app. It also ease distribution in some case.</p> <p>Just a side-note. Avoid using uber-jar as Maven dependency, as it is ruining the dependency resolution feature of Maven. Normally we create uber-jar only for the final artifact for actual deployment or for manual distribution, but not for putting to Maven repository.</p> <hr> <p>Update: I have just discovered I haven't answered one part of the question : "What's the point of renaming the packages of the dependencies?". Here is some brief updates and hopefully will help people having similar question.</p> <p>Creating uber-jar for ease of deployment is one use case of shade plugin. There are also other common use cases which involve package renaming.</p> <p>For example, I am developing <code>Foo</code> library, which depends on a specific version (e.g. 1.0) of <code>Bar</code> library. Assuming I cannot make use of other version of <code>Bar</code> lib (because API change, or other technical issues, etc). If I simply declare <code>Bar:1.0</code> as <code>Foo</code>'s dependency in Maven, it is possible to fall into a problem: A <code>Qux</code> project is depending on <code>Foo</code>, and also <code>Bar:2.0</code> (and it cannot use <code>Bar:1.0</code> because <code>Qux</code> needs to use new feature in <code>Bar:2.0</code>). Here is the dilemma: should <code>Qux</code> use <code>Bar:1.0</code> (which <code>Qux</code>'s code will not work) or <code>Bar:2.0</code> (which <code>Foo</code>'s code will not work)?</p> <p>In order to solve this problem, developer of <code>Foo</code> can choose to use shade plugin to rename its usage of <code>Bar</code>, so that all classes in <code>Bar:1.0</code> jar are embedded in <code>Foo</code> jar, and the package of the embedded <code>Bar</code> classes is changed from <code>com.bar</code> to <code>com.foo.bar</code>. By doing so, <code>Qux</code> can safely depends on <code>Bar:2.0</code> because now <code>Foo</code> is no longer depending on <code>Bar</code>, and it is using is own copy of "altered" <code>Bar</code> located in another package.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload