使用sbt native packager为scala play app创建rpm

时间:2018-04-18 22:11:56

标签: scala playframework sbt rpm sbt-native-packager

我正在使用sbt native packager(https://github.com/sbt/sbt-native-packager)为scala play应用程序创建rpm。我按照指令运行命令sbt rpm:packageBin。但是,它构建了.jar文件,这是rpm构建吗?我认为rpm构建应该是.rpm扩展名吗?

我确实收到了错误,但我仍然可以看到.jar文件

[info] Done packaging.
[error] `rpmVendor in Rpm` is empty.  Please provide a valid vendor for the rpm SPEC.
[error] java.lang.RuntimeException: There are issues with the rpm spec data.
[error]         at scala.sys.package$.error(package.scala:27)
[error]         at com.typesafe.sbt.packager.rpm.RpmSpec.validate(RpmMetadata.scala:154)
[error]         at com.typesafe.sbt.packager.rpm.RpmHelper$.stage(RpmHelper.scala:25)
[error]         at com.typesafe.sbt.packager.rpm.RpmPlugin$.$anonfun$projectSettings$47(RpmPlugin.scala:158)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:42)
[error]         at sbt.std.Transform$$anon$4.work(System.scala:64)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:257)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error]         at sbt.Execute.work(Execute.scala:266)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:257)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:167)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:32)
[error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error]         at java.lang.Thread.run(Thread.java:748)
[error] (rpm:stage) There are issues with the rpm spec data.

2 个答案:

答案 0 :(得分:1)

Play Framework需要一些额外的rpm设置。记录在案here in the Play Documentation。 为简单起见,我在这里复制相关部分:

最小RPM设置

将以下设置添加到您的构建中:

lazy val root = (project in file("."))
  .enablePlugins(PlayScala)

maintainer in Linux := "First Lastname <first.last@example.com>"
packageSummary in Linux := "My custom package summary"
packageDescription := "My longer package description"
rpmRelease := "1"
rpmVendor := "example.com"
rpmUrl := Some("http://github.com/example/server")
rpmLicense := Some("Apache v2")

然后用:

构建你的包
[my-first-app] $ rpm:packageBin

最后你应该{/ 1}}最终置于目标/ rpm / RPMS / noarch / -folder(或类似的东西)之下。

答案 1 :(得分:0)

发表评论后,我会说你需要在build.sbt文件中添加更多信息。

您的项目应包含有关rpm的数据。您可以使用很多设置here,但最低限度是将rpmVendor添加到您的build.sbt中,如下所示:

rpmVendor := "VendorName"

如果您需要示例,请查看Github上的部分内容。