首页 > 解决方案 > 在持续交付代理上使用 jpackage 构建 Windows 安装程序

问题描述

我在 CD 代理上运行 jpackage 任务时遇到问题。我收到以下错误:

light.exe : error LGHT0217 : Error executing ICE action 'ICE01'. The most common cause of this kind of ICE failure is an incorrectly registered scripting engine. See http://wixtoolset.org/documentation/error217/ for details and how to solve this problem. The following string format was not expected by the external UI message logger: "The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.".

我做了一些研究,基本上这个问题可以通过以下方式解决:

  1. 为代理的用户添加管理员权限
  2. env 变量大小的veryfing 大小(对于某些人来说,大小大于 32KB 的 env 变量会导致类似的错误)
  3. 抑制 ICE 验证

在我的情况下,每个解决方案都无关紧要或有问题。

  1. 我无法在 CD 上使用管理员用户
  2. env 变量小于 32KB (10KB)
  3. 我找不到使用 jpackage 抑制 ICE 验证的方法 - 我知道可以通过将 -sval 传递给 light.exe 或在 wixproj 文件中指定属性来完成,但我不知道如何将 light.exe 参数输入到 jpackage (如果可能的话)并且在 --resource-dir 中传递的 wixproj 文件似乎没有做任何更改。

需要明确的是,它在我的本地环境中运行良好。

所以很可能我的问题可以归结为是否可以从 jpackage 级别抑制 ICE 验证的问题。

我正在为 gradle 使用badass-runtime-plugin并尝试为 javafx + spring boot 应用程序构建安装程序。这是我的build.gradel相关部分:

runtime {
    modules = ['java.management', 'java.naming', 'java.instrument', 'java.sql', 'jdk.unsupported', 'jdk.security.jgss', 'java.desktop', 'java.logging', 'jdk.jfr', 'java.xml', 'java.scripting', 'jdk.crypto.cryptoki']
    options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
    launcher {
        noConsole = false
    }
    jpackage {
        mainClass = 'org.springframework.boot.loader.JarLauncher'
        imageOptions += ['--icon', "src/main/resources/graphics/icon.ico"]
        imageOptions += ['--win-console']
        installerOptions += ['--resource-dir', "src/main/resources"]
        installerOptions += ['--vendor', 'XYZ']
        installerOptions += ['--type', 'msi']
        installerOptions += ['--verbose']
        installerOptions += ['--resource-dir', "src/main/resources/wix"]
        installerOptions += ['--win-per-user-install', '--win-dir-chooser', '--win-menu', '--win-shortcut']
    }
}

标签: javawindowsgradlewixjpackage

解决方案


根据badass-runtime-plugin 的作者的说法,使用 jpackage 很可能无法做到这一点。

然而,我设法想出了一些肮脏的技巧,以某种方式让我实现了我的目标。我已经为 jpackage 添加了 tempDir 参数,然后在 gradle build 失败后,我使用 -sval 开关在 tempDir 的文件上“手动”运行 light.exe。


推荐阅读