Getting Started

The sbt-native-packager is a plugin. To use it, first create a project/plugins.sbt file with the following content.

addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "x.y.z")

Also, each operating system requires its own tools. These tools are specified in the operating system specific sections.

Version 1.0 and greater

If you use sbt 0.13.5 or greater you can enable sbt native packager by enabling it in your build.sbt. We recommend to use an archetype for setting up your build

enablePlugins(JavaAppPackaging)

but if you only want the bare minimum you can only add the packager plugin

enablePlugins(SbtNativePackager)

The autoplugins mechanism will import everything automatically.

Build.scala

If you use a Build.scala you can import the available keys with this statement

import com.typesafe.sbt.SbtNativePackager.autoImport._

Version 0.8.x or lower

If you don’t use autoplugins you need to import the available keys yourself. In your build.sbt or Build.scala add

import com.typesafe.sbt.SbtNativePackager._
import NativePackagerKeys._

Packaging Formats


*.deb

Packaging format for Debian based systems like Ubuntu

debian:packageBin
Debian Plugin »

*.rpm

Packaging format for Redhat based systems like RHEL or CentOS.

rpm:packageBin
Rpm Plugin »

*.msi

Packaging format for windows systems.

windows:packageBin
Windows Plugin »

*.dmg

Packaging format for osx based systems.

universal:packageOsxDmg
Universal Plugin »

docker

Package your application in a docker container.

docker:publishLocal
Docker Plugin »

*.zip

Packaging format for all systems supporting zip.

universal:packageBin
Universal Plugin »

*.tar

Packaging format for all systems supporting tar.

universal:packageZipTarball
Universal Plugin »

*.xz

Packaging format for all systems supporting xz.

universal:packageXzTarball
Universal Plugin »

jdkpackager

Oracle javapackager create packages for your running platform.

jdkPackager:packageBinl
JDK Packager Plugin »

Archetypes


Java Application

Creates a standalone package with an executable bash/bat script.
 

enablePlugins(JavaAppPackaging)
Learn more »

Java Server

Creates a standalone package with an executable bash/bat script and additional configuration and autostart.

enablePlugins(JavaServerAppPackaging)
Learn more »