BH4FFUBH4FFU

程序员
业余无线电爱好者

uber-jar? 惊!原来是这样

在阅读某些英文文档是,经常会看到uber-jar, 比如springboot的官方文档中

Java does not provide a standard way to load nested jar files (jar files that are themselves contained within a jar). This can be problematic if you are looking to distribute a self-contained application.

To solve this problem, many developers use “uber” jars. An uber jar packages all the classes from all the application’s dependencies into a single archive. The problem with this approach is that it becomes hard to see which libraries are in your application. It can also be problematic if the same filename is used (but with different content) in multiple jars.

Spring Boot takes a different approach and lets you actually nest jars directly.

那这到底代表什么意思呢?你有没有感觉奇怪?

其实在很多编程语言中会把super叫做uber (因为suber可能是关键字)这是上世纪80年代开始流行的,比如管superman叫uberman。
所以uber-jar从字面上理解就是super-jar,这样的jar不但包含自己代码中的class ,也会包含一些第三方依赖的jar,也就是把自身的代码和其依赖的jar全打包在一个jar里面了,所以就很形象的称其为super-jar。

你学废了么?

本原创文章未经允许不得转载 | 当前页面:BH4FFU » uber-jar? 惊!原来是这样

评论

文章评论已关闭!