如何解决使用sbt-native-packager构建deb的更改日志错误?

时间:2016-07-15 10:02:44

标签: sbt sbt-native-packager

我在build.sbt文件中有以下内容使用基于Java的.deb包构建并发布到Artifactory存储库:

enablePlugins(JavaAppPackaging, DebianPlugin, JDebPackaging, DebianDeployPlugin)

但是,当我尝试debian:publish时,我收到错误:

Creating changes file: /foo/bar/target/bar_1.0.0-SNAPSHOT_all.changes
java.lang.RuntimeException: Cannot generate .changes file without a changelog
    at scala.sys.package$.error(package.scala:27)
    at com.typesafe.sbt.packager.debian.DebianNativePackaging$$anonfun$debianNativeSettings$1.apply(NativePackaging.scala:49)
    at com.typesafe.sbt.packager.debian.DebianNativePackaging$$anonfun$debianNativeSettings$1.apply(NativePackaging.scala:47)
    at scala.Function6$$anonfun$tupled$1.apply(Function6.scala:35)
    at scala.Function6$$anonfun$tupled$1.apply(Function6.scala:34)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
    at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
    at sbt.std.Transform$$anon$4.work(System.scala:63)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
    at sbt.Execute.work(Execute.scala:237)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
    at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
[error] (debian:genChanges) Cannot generate .changes file without a changelog
[error] Total time: 1 s, completed 15-Jul-2016 09:47:53

我尝试添加

changelog in Debian := ""

the sbt native packager documentation中记录的build.sbt(好吧,文档没有说明它是什么类型,但我想sbt会告诉我,如果我的类型错了,那就没关系了)。但后来我收到了:

/foo/bar/build.sbt:31: error: not found: value changelog
changelog in Debian := ""
^
[error] Type error in expression
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?

我搜索了一个显示设置更改日志的示例,但我找不到。

3 个答案:

答案 0 :(得分:1)

DebianDeployPlugin似乎无法与JDebPackaging合作,而且我还不足以找出原因。

但是要构建.deb文件,只需添加:

debianChangelog in Debian := Some(file("debian/changelog"))

并创建一个包含

的文件debian/changelog
project-name (x.y.z) UNRELEASED; urgency=low

     * Initial no-op application.

 -- Your Name <your.email@example.com>  Fri, 15 Jul 2016 12:18:00 +0100

答案 1 :(得分:1)

忽略更改日志设置。请将以下行添加到build.sbt

<preference>

以下行告诉dpkg-deb仅运行import com.typesafe.sbt.packager.SettingsHelper._ makeDeploymentSettings(Debian, packageBin in Debian, "deb") ,没有deb building phase

答案 2 :(得分:-1)

尝试changelog in Debian := None