簡體   English   中英

使用 gradle 運行項目導致以非零退出值 1 結束

[英]Running project with gradle results in finished with non-zero exit value 1

每當我嘗試使用gradle run命令運行我的應用程序時,它的執行都會失敗並顯示以下錯誤:

17:12:58: Executing task ':TicTacToe.main()'...


> Configure project :
Project : => no module-info.java found

> Task :compileJava UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE

> Task :TicTacToe.main() FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings
3 actionable tasks: 1 executed, 2 up-to-date
Fehler: Zum Ausf�hren dieser Anwendung ben�tigte JavaFX-Runtime-Komponenten fehlen

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':TicTacToe.main()'.
> Process 'command 'C:/Program Files/Amazon Corretto/jdk15.0.2_7/bin/java.exe'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 234ms

特別是一條消息讓我很困惑:

Fehler: Zum Ausf hren dieser Anwendung ben tigte JavaFX-Runtime-Komponenten fehlen"

翻譯:“錯誤:應用程序需要缺少 JavaFX-Runtime-Compontens 才能執行應用程序。”

我的 gradle 不應該加載缺少的依賴項嗎?

由於我完全不知道我的 gradle 為什么以及如何失敗,我正在尋求幫助。

有關更多詳細信息,我將包含我的 build.gradle:

plugins {
    id 'java'
    id 'application'
    id 'org.openjfx.javafxplugin' version '0.0.9'
}

group 'tictactoe'

repositories {
    mavenCentral()
}

dependencies {
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
}

test {
    useJUnitPlatform()
}

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

application {
    mainClass = 'tictactoe.TicTacToe'
}

簡而言之,最重要的是——你需要這個 openjfx.io 你使用的是 Java 14 版本。 從 11 版本開始,他們刪除了 JavaFX,它可以作為一個單獨的模塊使用。 因此,它在你的罐子里是陳腐的,而不是。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM