我在 IntelliJ 中有一個使用 Gradle 配置的 JavaFX 專案。每當我嘗試直接從 IntelliJ 運行gradlew.bat clean build或直接執行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'
}
uj5u.com熱心網友回復:
org.openjfx.javafxplugin將(https://plugins.gradle.org/plugin/org.openjfx.javafxplugin )更新到內部的最新版本build.gradle(從IntelliJ 添加的 0.0.10 到0.0.13 )似乎已經解決了這個問題。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/482599.html
上一篇:外部庫版本沖突
