sbtsbt-native-packager

How to solve changelog error for building deb with sbt-native-packager?


I have the following in my build.sbt file to use Java-based .deb package building and publish to an Artifactory repository:

enablePlugins(JavaAppPackaging, DebianPlugin, JDebPackaging, DebianDeployPlugin)

However, when I try to do debian:publish, I get the error:

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

I tried to add

changelog in Debian := ""

to my build.sbt as documented in the sbt native packager documentation (well, the documentation didn't specify what type it was, but I thought sbt would tell me if I had the wrong type so that would be fine). But then I received:

/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?

I searched for an example showing setting the changelog, but I could not find one.


Solution

  • DebianDeployPlugin doesn't seem to work with JDebPackaging, and I'm not enough of an sbt guru to figure out why.

    But to just build the .deb file, it's enough to add:

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

    and create a file debian/changelog containing

    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