【问题标题】:cannot to add module to jpackage-created application无法将模块添加到 jpackage 创建的应用程序
【发布时间】:2020-07-14 08:52:50
【问题描述】:

我在将 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"]
}

那也没用。

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

【问题讨论】:

    标签: java ssl module jpackage


    【解决方案1】:

    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']
            }
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2021-06-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多