1

我制作了一个包含以下详细信息的 JavaFX 项目:

OpenJFX 15-ea+3/// JDK 14_ Gradle_Non-modular

另外,我使用以下 Gradle 插件:

javafxplugin version 0.0.8/ org.beryx.runtime version 1.8.2& com.github.johnrengelman.shadow version 5.2.0(用于创建原生图像)

此外,JDK 14jpackage工具用于为应用程序创建安装程序包。这是build.gradle文件:

plugins {
    id 'java'
    id 'application'
    id 'org.openjfx.javafxplugin' version '0.0.8'
    id 'org.beryx.runtime' version '1.8.2'
    id "com.github.johnrengelman.shadow" version "5.2.0"
}

group 'com.pastor'
version '1.0-SNAPSHOT'

sourceCompatibility = 14
targetCompatibility = 14
//This option is for rendering persian characters encoding
compileJava.options.encoding = 'UTF-8'

javafx {
    version = "15-ea+3"
    modules = [ 'javafx.controls', 'javafx.fxml']
}

repositories {
    mavenCentral()
}

dependencies {
    runtimeOnly "org.openjfx:javafx-controls:$javafx.version:win"
    runtimeOnly "org.openjfx:javafx-fxml:$javafx.version:win"
    runtimeOnly "org.openjfx:javafx-media:$javafx.version:win"
    compile group: 'com.jfoenix', name: 'jfoenix', version: '9.0.9'
    compile 'de.jensd:fontawesomefx-fontawesome:4.7.0-9.1.2'
    compile 'de.jensd:fontawesomefx-icons525:4.2.0-9.1.2'
    compile 'de.jensd:fontawesomefx-materialdesignfont:2.0.26-9.1.2'
    compile 'de.jensd:fontawesomefx-materialicons:2.2.0-9.1.2'
    compile group: 'org.controlsfx', name: 'controlsfx', version: '11.0.1'
}

runtime {
    options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
    jpackage {
        if(org.gradle.internal.os.OperatingSystem.current().windows) {
            appVersion = '1.0.0'
            skipInstaller = false
            installerName = 'Pastor apartment unit management system'
            installerType = 'exe'
            installerOptions = ['--win-per-user-install', '--win-dir-chooser', '--win-menu', '--win-shortcut']
        }
    }
}
mainClassName = 'sample.Launcher'

我已经imageOptions = ['--icon icon.ico']jpackage块内尝试过,但我总是收到这种错误:

Error: Invalid Option: [--icon app.ico]

非常感谢任何有用的建议或提示。

4

1 回答 1

0

我从未使用过该插件,但我会尝试添加'--icon', 'icon.ico'到 installerOptions 而不是 imageOptions。

于 2020-05-07T07:38:44.873 回答