You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Java Gradle项目构建失败求助:Maven迁移后遇异常

Maven迁移Gradle后异常排查求助

近期将项目从Maven迁移至Gradle,遵循官方迁移指南操作后,先触发废弃API异常,修复该问题后又出现冗长的报错信息。已自行排查3小时仍未解决,希望得到帮助。

Gradle扫描标识:cruao44la4fhq

我的build.gradle文件内容:

plugins {
    id 'java'
    id 'application'
    id 'org.javamodularity.moduleplugin' version '1.8.15'
    id 'org.openjfx.javafxplugin' version '0.1.0'
    id 'org.beryx.jlink' version '3.0.1'
}

dependencies {
    // Gson依赖
    implementation("com.google.code.gson:gson:2.10.1")
    // Jackson相关依赖
    implementation("com.fasterxml.jackson.core:jackson-databind:2.17.0")
    implementation("com.fasterxml.jackson.core:jackson-core:2.17.0")
    implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.17.0")
}

group 'net.jchad'
version '1.0-SNAPSHOT'

repositories {
    mavenCentral()
}

ext {
    junitVersion = '5.10.0'
}

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

application {
    mainModule = 'net.jchad.net'
    mainClass = 'net.jchad.net.jchad.installer.mainclass.Main'
}

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

dependencies {
    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'
}

内容的提问来源于stack exchange,提问作者Dari_OS

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.26 05:05:15