Java Server Application Archetype

In the Application Packaging section we described how to build and customize settings related to an application. The server archetype adds additional features you may need when running your application as a service on a server. SBT Native Packager ships with a set of predefined install and uninstall scripts for various platforms and service managers.

Features

The JavaServerAppPackaging archetype contains all JavaAppPackaging feature and the following

  • install/uninstall services
  • default mappings for server applications
  • Creates a start script in /etc/init.d (SystemV) or /etc/init/ (Upstart)

Usage

Version 1.0 or higher with sbt 0.13.5 and and higher

enablePlugins(JavaServerAppPackaging)

Version 0.8 or lower

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

packageArchetype.java_server

Customize

The server archetype provides additional options to customize your application behaviour at buildtime, installation, uninstallation and during runtime. The basic application script customization is discussed in Java Application Customization.

Service Managers

Platforms are tied to both package managers (Rpm, Debian) and Service Managers (System V, Upstart, SystemD). By default the native packager will configure a service manager to run the daemon process. The available configurations are:

Platform Service Manager Working
Ubuntu Upstart (Default) X
Ubuntu System V X
CentOS System V (Default) X
CentOS 6.5 Upstart X
Fedora System V (Default) X
Fedora systemd experimental
Windows Windows Services