1

我在将 jpackage 创建的应用程序连接到 websocket 端点时遇到问题。通过我的 IDE 运行时协商的密码在构建的映像中不可用。看来我遇到了这里描述的问题:https ://www.gubatron.com/blog/2019/04/25/solving-received-fatal-alert-handshake_failure-error-when-performing-https-connections-on -a-custom-made-jre-with-jlink/

我现在正在尝试添加jdk.crypto.cryptoki到我的 jpackage 并且无法添加。

我第一次尝试这个

runtime {
    options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
    jpackage {
        imageName = 'MyCorpDashboard'
        installerName = 'MyCorpInstaller'
        appVersion = '0.1.0'
        if(org.gradle.internal.os.OperatingSystem.current().windows) {
            jpackageHome = 'D:\\Java\\jdk-14' // Needs to be JDK 14
            installerType = 'exe'
            jvmArgs = ['-Djava.security.debug=access,stack',
                       '-Dhttps.protocols=SSLv2,TLSv1.2',
                       '-Djavax.net.debug=ssl:handshake:verbose'
                       '--add-modules', 'jdk.crypto.cryptoki']
            imageOptions = ['--win-console', '--icon','src/main/resources/com/mycorp/ui/dashboard/icon_wh.ico']
            installerOptions = ['--win-per-user-install',
                            '--win-dir-chooser',
                            '--win-menu',
                            '--win-shortcut',
                            '--vendor', 'My Corp']
        } else if (org.gradle.internal.os.OperatingSystem.current().macOsX) {
            jpackageHome = '/Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home/' // Needs to be JDK 14
            imageOptions = ['--vendor', 'My Corp',
                            '--icon','src/main/resources/com/mycorp/ui/dashboard/icon_wh.icns']
        }
    }
}

但得到

Error occurred during initialization of boot layer
java.lang.module.FindException: Module jdk.crypto.cryptoki not found

我也试过

compileJava {
    options.compilerArgs += ["--add-modules", "jdk.crypto.cryptoki"]
}

这也不起作用。

我如何添加这个模块以便它与我的应用程序一起打包?

4

1 回答 1

0

oi - 发布后我想我现在在运行时看到它(在重新访问https://badass-runtime-plugin.beryx.org/releases/latest/之后)

runtime {
    options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
    modules = ['jdk.crypto.cryptoki']
    jpackage {
        imageName = 'MyCorpDashboard'
        installerName = 'MyCorpInstaller'
        appVersion = '0.1.0'
        if(org.gradle.internal.os.OperatingSystem.current().windows) {
            jpackageHome = 'D:\\Java\\jdk-14' // Needs to be JDK 14
            installerType = 'exe'
            jvmArgs = ['-Djava.security.debug=access,stack',
                       '-Dhttps.protocols=SSLv2,TLSv1.2',
                       '-Djavax.net.debug=ssl:handshake:verbose']
            imageOptions = ['--win-console', '--icon','src/main/resources/com/mycorp/ui/dashboard/icon_wh.ico']
            installerOptions = ['--win-per-user-install',
                            '--win-dir-chooser',
                            '--win-menu',
                            '--win-shortcut',
                            '--vendor', 'My Corp']
        } else if (org.gradle.internal.os.OperatingSystem.current().macOsX) {
            jpackageHome = '/Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home/' // Needs to be JDK 14
            imageOptions = ['--vendor', 'My Corp',
                            '--icon','src/main/resources/com/mycorp/ui/dashboard/icon_wh.icns']
        }
    }
}
于 2020-07-14T00:52:50.387 回答