Sbt-native-packager: windows:packageBin does not work

Following the instruction here I tried to run windows:packageBin but there is no such task in IntelliJ’s sbt side-bar and if I try to execute the task in the sbt shell I get

[error] stack trace is suppressed; run 'last wixProductXml' for the full output
[error] (wixProductXml) java.util.NoSuchElementException: key not found:
[error] Total time: 0 s, completed 24.03.2020 22:15:51

My build.sbt looks like this:

name := "GlobalConfigEditor"

version := "0.3-SNAPSHOT"

scalaVersion := "2.13.1"

enablePlugins(WindowsPlugin)

val mainClassName = "globalconfig.ConfigEditorApplication"
mainClass in assembly := Some(mainClassName)
assemblyJarName in assembly := s"UniqaGlobalConfigEditor-$version.jar"

assemblyMergeStrategy in assembly := {
  case PathList("META-INF", xs@_*) => MergeStrategy.discard
  case PathList("reference.conf") => MergeStrategy.concat
  case x => MergeStrategy.first
}

// general package information (can be scoped to Windows)
maintainer := "J. Doe <[email protected]"
packageSummary := "test-windows"
packageDescription := """Test Windows MSI."""

// wix build information
wixProductId := "ce07be71-510d-414a-92d4-dff47631848a"
wixProductUpgradeId := "4552fb0e-e257-4dbd-9ecb-dba9dbacf424"

libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.9"
libraryDependencies += "commons-io" % "commons-io" % "2.6"
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.3"
libraryDependencies += "com.typesafe.scala-logging" % "scala-logging_2.13" % "3.9.2"
libraryDependencies += "com.typesafe.akka" %% "akka-actor-typed" % "2.6.3"

libraryDependencies += "org.scalatest" %% "scalatest" % "3.1.1" % "test"
libraryDependencies += "org.scalamock" %% "scalamock" % "4.4.0" % Test
libraryDependencies += "org.mockito" % "mockito-scala_2.13" % "1.11.3"
libraryDependencies += "org.mockito" % "mockito-scala-scalatest_2.13" % "1.11.3"

plugins.sbt:

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.7.0")

Any ideas what the problem might be?

Nobody?

running last wixProductXml as suggested, I see:

[error] 	at scala.collection.immutable.Map$EmptyMap$.apply(Map.scala:101)
[error] 	at scala.collection.immutable.Map$EmptyMap$.apply(Map.scala:99)
[error] 	at com.typesafe.sbt.packager.windows.WixHelper$.makeWixProductConfig(WixHelper.scala:184)
[error] 	at com.typesafe.sbt.packager.windows.WindowsPlugin$.$anonfun$windowsSettings$16(WindowsPlugin.scala:84)

after hub clone sbt/sbt-native-packager; cd sbt-native-packager; git checkout v1.7.0 I looked at line 184 of src/main/scala/com/typesafe/sbt/packager/windows/WixHelper.scala in an editor and saw:

          <Directory Id='INSTALLDIR' Name={ name }>
            { dirToChildren("") map dirXml }
          </Directory>

So it appears dirToChildren is empty. That’s as far as I got in troubleshooting this — I had trouble understanding the intent of the code earlier in the method, not really knowing what any of this is about.

The error message is poor; I’d suggest reporting it at https://github.com/sbt/sbt-native-packager/issues

Perhaps you could find an actual project somewhere on GitHub that has this configured right and see what they’re doing.

1 Like

Thank you, I will try that. sbt won’t break me. Yet, anyways :slight_smile:

I see you’ve opened https://github.com/sbt/sbt-native-packager/issues/1322

Yes, I did. Let’s see what will come down the alley.

Disclimer: I do know that the described problem is not necessarily caused by a bug or problem in sbt, but more likely due to a problem on my side. But if there is nobody who actually can help me I cannot continue to use this tool.

Guys, don’t get me wrong, I realize that sbt most likely is developed and driven by volunteers.

But I would like to understand how long it takes to at least consider and categorize an issue on Github. I need to know how those things are usually handled. If the answer is that this can take its time this is completely fine for me, but then I have to overthink my decision to use sbt for projects I actually need to get done.

sbt-native-packager is entirely volunteer-driven, and it isn’t part of sbt — it’s a plugin.

I don’t think you can count on receiving free support online for other build tools (and their plugin ecosystems), either.

2 Likes

I don’t ask for free but for reliable support. I just don’t know another place than Github to raise issues. For my personal projects, I am happy to wait for help - and help myself, if possible, but for the professional, bill-paying side of the view, I need to look into something else then :slight_smile:

I greatly appreciate the help and the supportive approach of the Scala community and that is why I try to stick to it :slight_smile:

If I find out what breaks the build I will share it here with all of you!

Note that Lightbend (where I work) offers commercial support for sbt (and Scala, and Akka, and Play, and…). That support doesn’t formally cover third-party plugins such as sbt-native-packager, but in practice, our support team will make a reasonable effort to answer such questions anyway.