tldr: the jdkPackager plugin can't find my custom WiX config file. How can I correctly add it to my classpath so that the plugin can find it?
I am using sbt 0.13.16 and sbt-native-packager 1.0.2.
I am using the jdkPackager plugin to build an msi. When running sbt jdkPackager:packageBin
, my msi is successfully created and installs. What I need, is to now use a custom WiX Config file in order to set the WiX upgradeCode and add a MajorUpgrade element to handle upgrades.
The output of the jdkPackager command, has this instruction to do so:
Config files are saved to <MY_APP_DATA>\Local\Temp\fxbundler2011134430419607265\windows. Use them to customize package.
Using default package resource [WiX config file] (add package/windows/my-app-name.wxs to the class path to customize)
I made a copy of the default wxs file that was created and added to the above temp folder and edited it to contain the upgradeCode and MajorUpgrade element.
My issue: I have tried placing this file in many areas around my project structure to add it to my classpath, but the packager never finds it and always outputs that it is using the default config file.
Some locations I have tried:
- src/main/package/windows/my-app-name.wxs
- src/main/deploy/package/windows/my-app-name.wxs
- ./package/windows/my-app-name.wxs
- src/main/resources/package/windows/my-app-name.wxs
- and many more... similar variations, with or without the package/windows structure.
I also tried manually adding the file or the parent directory to my unmanagedClasspath in my build.sbt. ie:
unmanagedClasspath in Runtime += baseDirectory.value / "src/main/deploy/"
After packaging, I was using sbt "show runtime:fullClasspath"
to verify the wxs file and/or the containing directory is included in my classpath. I also checked the target/universal/stage directory and the config file and directory structure is copied there when included in the resources folder. Nothing seems to have an effect.
I have been use these primary resources:
- http://www.scala-sbt.org/sbt-native-packager/formats/jdkpackager.html (docs)
- https://github.com/sbt/sbt-native-packager/tree/e4e6504c1f6a75fb346958f68d0f7c13fec26877/src/main/scala/com/typesafe/sbt/packager/jdkpackager (source code)
- https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html#BCGICFDB (customizing package using drop-in resources)
- http://wixtoolset.org/documentation/manual/v3/howtos/updates/major_upgrade.html (WiX major upgrade docs)
- where should i put installer resources (wxs file,dmg-script,icon) and how to configure maven antrun when deploying self contained app (A few slightly similar SO questions for ant builds)
Side note: I am open to solving this in other ways. I tried adding the wixProductUpgradeId and wixProductId to my build.sbt, but they don't appear to be used for the jdkPackager plugin. I also went down the avenue of using the Windows plugin, but, from what I could understand, an executable was never created. Instead the msi just tried to run a (faulty) bat script.
I'd appreciate any help/experience/advice. Thanks!