Gradle "Couldn't replace placeholder" 构建中

Gradle "Couldn't replace placeholder" on build

我有一个在 IntelliJ 中配置了 Gradle 的 JavaFX 项目。 每当我尝试 运行 gradlew.bat clean build 或直接从 IntelliJ 执行 build 任务时,这就是我收到的:

> Task :startScripts FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':startScripts'.
> Couldn't replace placeholder in E:\git\yuber\build\scripts\yuber

我也在使用 shadowJar 插件,当我尝试创建 jar 文件并 运行 它时,它确实有效。它完美地工作。虽然,我不确定为什么它不会建立。到处找答案,但目前似乎没有人真正遇到过这个问题?

这是我的 build.gradle 文件:

plugins {
    id 'java'
    id 'application'
    id 'org.openjfx.javafxplugin' version '0.0.10'
    id 'org.beryx.jlink' version '2.24.1'
    id "com.github.johnrengelman.shadow" version "7.1.2"
}

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

repositories {
    mavenCentral()
}

ext {
    junitVersion = '5.8.2'
}

sourceCompatibility = '11'
targetCompatibility = '11'

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

application {
    mainModule = 'com.example.yuber'
    mainClass = 'com.example.yuber.Launcher'
}

javafx {
    version = '11.0.2'
    modules = ['javafx.controls', 'javafx.fxml', 'javafx.web']
}

dependencies {
    implementation('org.controlsfx:controlsfx:11.1.0')
    implementation('com.dlsc.formsfx:formsfx-core:11.3.2') {
        exclude(group: 'org.openjfx')
    }
    implementation('net.synedra:validatorfx:0.1.13') {
        exclude(group: 'org.openjfx')
    }
    implementation('org.kordamp.ikonli:ikonli-javafx:12.2.0')
    implementation('org.kordamp.bootstrapfx:bootstrapfx-core:0.4.0')
    implementation('eu.hansolo:tilesfx:11.48') {
        exclude(group: 'org.openjfx')
    }
    implementation 'org.json:json:20220320'
    implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.2.2'
    implementation 'com.fasterxml.jackson.core:jackson-core:2.13.2'
    implementation 'com.fasterxml.jackson.core:jackson-annotations:2.13.2'
    implementation 'junit:junit:4.13.1'

    testImplementation("org.junit.jupiter:junit-jupiter-api:${junitVersion}")
    testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")
}

test {
    useJUnitPlatform()
}

jlink {
    imageZip = project.file("${buildDir}/distributions/app-${javafx.platform.classifier}.zip")
    options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
    launcher {
        name = 'app'
    }
}

jlinkZip {
    group = 'distribution'
}

org.openjfx.javafxplugin (https://plugins.gradle.org/plugin/org.openjfx.javafxplugin) 更新到 build.gradle 中的最新版本(来自 0.0.10,正如 IntelliJ 添加的那样,至 0.0.13) 似乎已解决问题。