Getting Started¶
Setup¶
Sbt-native-packager is an AutoPlugin. Add it to your plugins.sbt
addSbtPlugin("com.github.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