在运行debian时包含upstart脚本:packageBin

时间:2013-12-22 16:09:49

标签: scala debian sbt deb sbt-native-packager

我想在ubuntu机器上启动我的scala应用程序作为后台服务。我目前正在尝试弄清楚如何在我的包任务中使用JavaServerAppPackaging Settings

有什么建议,我必须添加哪些内容在我的deb文件中包含upstart脚本?

这是我的项目描述incl。 oneJar和debian建筑。

 lazy val root = Project(id = appName, base = file("."), settings = SbtOneJar.oneJarSettings ++ packageSettings ++ allSettings ++ Project.defaultSettings)

  lazy val allSettings = Seq(
    mainClass in SbtOneJar.oneJar := Some("Kernel"),
    resolvers += "Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases",
    resolvers += "Sonatype OSS Snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/",
    libraryDependencies ++= dependencies)

  lazy val packageSettings = JavaServerAppPackaging.settings ++ packagerSettings ++ Seq(
    version := appVersion,
    packageSummary := appName,
    packageDescription := appName,
    maintainer := appAuthor,
    mappings in Universal += {
      SbtOneJar.oneJar.value -> jarFsPath
    },
    linuxPackageMappings in Debian <+= (SbtOneJar.oneJar) map {
      jar: File =>
        (packageMapping(jar -> jarFsPath) withUser unixUser withGroup unixGroup withPerms "0755")
    },
    debianPackageDependencies in Debian ++= Seq("openjdk-7-jre-headless"))
}

1 个答案:

答案 0 :(得分:3)

设置应包含packageArchetype.java_server值,例如:

lazy val packageSettings = packageArchetype.java_server ++ Seq(
/* ... */ 
}