Getting Started¶
Setup¶
Sbt-native-packager is an AutoPlugin. Add it to your plugins.sbt
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "x.y.z")
Native Tools¶
Depending on the package format you want to create, you may need additional tools available on your machine. Each packaging format has a requirements section.
Your first package¶
Native packager provides packaging format plugins and archetype plugins to separate configuration and actual packaging. To get started we use the basic Java Application Archetype. For more archetypes see the archetypes page.
In your build.sbt
you need to enable the archetype like this
enablePlugins(JavaAppPackaging)
This will also enable all supported format plugins.
Run the app¶
Native packager can stage your app so you can run it locally without having the app packaged.
sbt stage
./target/universal/stage/bin/<your-app>
Create a package¶
We can generate other packages via the following tasks. Note that each packaging format may needs some additional configuration and native tools available. Here’s a complete list of current formats.
universal:packageBin
- Generates a universal zip fileuniversal:packageZipTarball
- Generates a universal tgz filedebian:packageBin
- Generates a debdocker:publishLocal
- Builds a Docker image using the local Docker serverrpm:packageBin
- Generates an rpmuniversal:packageOsxDmg
- Generates a DMG file with the same contents as the universal zip/tgz.windows:packageBin
- Generates an MSI