sbt-pack 和 sbt-assembly 之间的主要区别是什么? [英] What are key differences between sbt-pack and sbt-assembly?

查看:40
本文介绍了sbt-pack 和 sbt-assembly 之间的主要区别是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚偶然发现了 sbt-pack 插件.开发流程似乎稳定.这让我感到惊讶,因为我相信(引用 sbt-pack 的标题)创建可分发的 Scala 包." 的唯一插件是 sbt-assembly(以及其他功能).

I've just stumbled upon the sbt-pack plugin. The development stream seems steady. It's surprising to me as I believed that the only plugin for (quoting sbt-pack's headline) "creating distributable Scala packages." is sbt-assembly (among the other features).

插件之间的主要区别是什么?我什么时候应该使用一个?

What are the key differences between the plugins? When should I use one over the other?

推荐答案

(免责声明:我维护 sbt-assembly)

(Disclaimer: I maintain sbt-assembly)

sbt-assembly 创建一个胖 JAR - 一个包含所有类文件的 JAR 文件代码和库.通过演变,它还包含在多个 JAR 提供相同文件路径(如配置或 README 文件)时解决冲突的方法.它涉及到所有库 JAR 的解压,所以速度有点慢,但这些都被大量缓存.

sbt-assembly creates a fat JAR - a single JAR file containing all class files from your code and libraries. By evolution, it also contains ways of resolving conflicts when multiple JARs provide the same file path (like config or README file). It involves unzipping of all library JARs, so it's a bit slow, but these are heavily cached.

sbt-pack 保持所有库 JAR 完好无损,将它们移动到 target/pack 目录(而不是它们通常所在的常春藤缓存),并为您制作一个 shell 脚本来运行它们.

sbt-pack keeps all the library JARs intact, moves them into target/pack directory (as opposed to ivy cache where they would normally live), and makes a shell script for you to run them.

sbt-native-packager 类似于 sbt-pack 但它由 sbt 提交者 Josh Suereth 发起,现在由功能强大的 Nepomuk Seiler(也称为 muuki88).该插件支持多种格式,如 Windows msi 文件和 Debian deb 文件.最近添加的是对 Docker 图像的支持.

sbt-native-packager is similar to sbt-pack but it was started by a sbt committer Josh Suereth, and now maintained by highly capable Nepomuk Seiler (also known as muuki88). The plugin supports a number of formats like Windows msi file and Debian deb file. The recent addition is a support for Docker images.

所有这些都是创建部署映像的可行方法.在某些情况下,例如将您的应用程序部署到网络框架等,如果您处理一个文件而不是十几个文件,这可能会使事情变得更容易.

All are viable means of creating deployment images. In certain cases like deploying your application to a web framework etc., it might make things easier if you're dealing with one file as opposed to a dozen.

荣誉提名:sbt-progardsbt-onejar.

这篇关于sbt-pack 和 sbt-assembly 之间的主要区别是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆