beryx / badass-jlink-plugin

Create a custom runtime image of your modular application
https://badass-jlink-plugin.beryx.org
Apache License 2.0
385 stars 27 forks source link

Windows msi installer package failed #196

Closed GordonGgx closed 3 years ago

GordonGgx commented 3 years ago

Before,I have installed WIX. Here is my gradle config:

plugins {
    id 'application'
    id 'org.openjfx.javafxplugin' version '0.0.9'
    id 'org.beryx.jlink' version '2.24.1'
}

group 'org.example'
version '1.0-SNAPSHOT'

repositories {
    mavenCentral()
}

tasks.withType(JavaCompile){
    options.encoding("UTF-8")
}

targetCompatibility=JavaVersion.VERSION_15
sourceCompatibility=JavaVersion.VERSION_15

javafx {
    version = "17"
    modules = [ 'javafx.controls']

}

application{
    mainModule='AppList.main'
    mainClass='com.ecarx.applist.Main'
    description("AOSP 应用集成工具")
}

def os = org.gradle.internal.os.OperatingSystem.current()
jlink {
    launcher {
        name = 'AppManifest'
        noConsole=true
    }

    options = ['--bind-services', '--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
    imageName="AppManifest"
    setMainClassName("com.ecarx.applist.Main")
    if(os.windows){
        javaHome="C:\\Users\\ggx\\Downloads\\jdk-15.0.2"
    }else if(os.linux){
        javaHome="/home/ggx/Documents/jdk-15.0.2"

    }

    jpackage{
        imageName="AppManifest"
        installerName="ecarx_app_manifest"
        appVersion='1.0'
        if(os.isWindows()) {
            jpackageHome='C:\\Users\\ggx\\Downloads\\jdk-15.0.2'

            imageOptions += ['--icon', './AppManifest.ico']
            installerOptions += [
                    '-t','msi',
                    '--win-per-user-install',
                    '--win-dir-chooser',
                    '--win-menu',
                    '--win-shortcut']
//            imageOptions +=['--win-console']
        }else if(os.isLinux()){
            jpackageHome='/home/ggx/APPS/jdk-16.0.1'
            imageOptions += ['--icon', './AppManifest.png']
            installerOptions +=[
                    '-t','deb',
                    '--resource-dir', "build/jpackage/AppManifest/lib",
                    '--linux-shortcut',
                    '--linux-menu-group', 'Internet',
                    '--linux-deb-maintainer', 'guoxiang.guan@ecarx.com.cn',
                    '--description', project.description,
            ]
        }else if(os.isMacOsX()){
            installerType="app-image"
            imageOptions += ['--icon', './AppManifest.icns']
        }
    }

}

dependencies {
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.2'
    implementation 'org.yaml:snakeyaml:1.29'
//    implementation 'org.apache.commons:commons-lang3:3.12.0'
//    implementation 'commons-net:commons-net:20030805.205232'
    implementation 'org.controlsfx:controlsfx:11.1.0'
}

test {
    useJUnitPlatform()
}

After run ./gradlew jpackage

specified database code page '1252'. Either change these characters to ones that exist in the database's code page, or update the database's code page by modifying one of the following a
ttributes: Product/@Codepage, Module/@Codepage, Patch/@Codepage, PatchCreation/@Codepage, or WixLocalization/@Codepage.
C:\Users\ggx\AppData\Local\Temp\jdk.incubator.jpackage13966361706816309380\config\bundle.wxf(2557) : error LGHT0311 : A string was provided with characters that are not available in the
specified database code page '1252'. Either change these characters to ones that exist in the database's code page, or update the database's code page by modifying one of the following a
ttributes: Product/@Codepage, Module/@Codepage, Patch/@Codepage, PatchCreation/@Codepage, or WixLocalization/@Codepage.
C:\Users\ggx\AppData\Local\Temp\jdk.incubator.jpackage13966361706816309380\config\bundle.wxf(2566) : error LGHT0311 : A string was provided with characters that are not available in the
specified database code page '1252'. Either change these characters to ones that exist in the database's code page, or update the database's code page by modifying one of the following a
ttributes: Product/@Codepage, Module/@Codepage, Patch/@Codepage, PatchCreation/@Codepage, or WixLocalization/@Codepage.
C:\Users\ggx\AppData\Local\Temp\jdk.incubator.jpackage13966361706816309380\config\bundle.wxf(2735) : error LGHT0311 : A string was provided with characters that are not available in the
specified database code page '1252'. Either change these characters to ones that exist in the database's code page, or update the database's code page by modifying one of the following a
ttributes: Product/@Codepage, Module/@Codepage, Patch/@Codepage, PatchCreation/@Codepage, or WixLocalization/@Codepage.
C:\Users\ggx\AppData\Local\Temp\jdk.incubator.jpackage13966361706816309380\config\bundle.wxf(2730) : error LGHT0311 : A string was provided with characters that are not available in the
specified database code page '1252'. Either change these characters to ones that exist in the database's code page, or update the database's code page by modifying one of the following a
ttributes: Product/@Codepage, Module/@Codepage, Patch/@Codepage, PatchCreation/@Codepage, or WixLocalization/@Codepage.
java.io.IOException: Command [C:\Program Files (x86)\WiX Toolset v3.11\bin\light.exe, -nologo, -spdb, -ext, WixUtilExtension, -out, C:\Users\ggx\AppData\Local\Temp\jdk.incubator.jpackage
13966361706816309380\images\win-exe.image\AppManifest-1.0.msi, -sice:ICE27, -sice:ICE91, -ext, WixUIExtension, -loc, C:\Users\ggx\AppData\Local\Temp\jdk.incubator.jpackage139663617068163
09380\config\MsiInstallerStrings_en.wxl, -b, C:\Users\ggx\AppData\Local\Temp\jdk.incubator.jpackage13966361706816309380\config, C:\Users\ggx\AppData\Local\Temp\jdk.incubator.jpackage1396
6361706816309380\wixobj\main.wixobj, C:\Users\ggx\AppData\Local\Temp\jdk.incubator.jpackage13966361706816309380\wixobj\bundle.wixobj]in C:\Users\ggx\AppData\Local\Temp\jdk.incubator.jpac
kage13966361706816309380\images\win-msi.image\AppManifest exited with 311 code
        at jdk.incubator.jpackage/jdk.incubator.jpackage.internal.Executor.executeExpectSuccess(Executor.java:75)
        at jdk.incubator.jpackage/jdk.incubator.jpackage.internal.WixPipeline.execute(WixPipeline.java:131)
        at jdk.incubator.jpackage/jdk.incubator.jpackage.internal.WixPipeline.buildMsi(WixPipeline.java:95)
        at jdk.incubator.jpackage/jdk.incubator.jpackage.internal.WinMsiBundler.buildMSI(WinMsiBundler.java:485)
        at jdk.incubator.jpackage/jdk.incubator.jpackage.internal.WinMsiBundler.execute(WinMsiBundler.java:363)
        at jdk.incubator.jpackage/jdk.incubator.jpackage.internal.WinExeBundler.bundle(WinExeBundler.java:100)
        at jdk.incubator.jpackage/jdk.incubator.jpackage.internal.WinExeBundler.execute(WinExeBundler.java:73)
        at jdk.incubator.jpackage/jdk.incubator.jpackage.internal.Arguments.generateBundle(Arguments.java:680)

I hope I can get your help.Thanks.

siordache commented 3 years ago

You currently use a jdk15 jpackage:

jpackageHome='C:\\Users\\ggx\\Downloads\\jdk-15.0.2'

Try using a more recent version, which is not affected by the following issues: https://bugs.openjdk.java.net/browse/JDK-8232621 https://bugs.openjdk.java.net/browse/JDK-8255619

You may also need to change the value of the Culture parameter of light.exe by providing a custom WXL file, as in this example project. The example project uses the badass-runtime-plugin, but the workaround should also apply to the badass-jlink-plugin.

GordonGgx commented 3 years ago

@siordache Cool! After upgrading to openjdk16, I succeeded by referring to ! this example project. Thank you very much