gpt4 book ai didi

gradle - gradle/JavaFX 项目中模块 javafx.base 的两个版本

转载 作者:行者123 更新时间:2023-12-04 11:36:26 25 4
gpt4 key购买 nike

我的团队正在开发一个 Java 项目。 (git repo @ https://github.com/RaiderRobotix/Scouting-Client-FX)。我们正在尝试使用 jlink 对其进行打包。运行jlink任务( gradlew jlink )时显示如下。我在 macOS 上使用 gradle 6.1.1 和 jdk 11。如果您想查看我们的 module-info.java,请查看 repo。我不想让这个问题太长。

顺便说一句,我的机器上有多个 JDK(8,11)。构建项目有效,但使用 gradlew run 运行它没有(我认为它与 lombok 无关)。

完整错误:Error: Two versions of module javafx.base found in ./build/jlinkbase/jlinkjars (Infinite Recharge Client-v4.0.0-alpha.jar and javafx-base-11-mac.jar)
构建.gradle

plugins {
id 'java'
id 'idea'
id "org.openjfx.javafxplugin" version "0.0.8"
id 'org.beryx.jlink' version '2.17.2'
id "com.github.johnrengelman.shadow" version "5.2.0"
id 'org.jetbrains.kotlin.jvm' version '1.3.61'
id 'com.github.gmazzo.buildconfig' version '1.6.2'
}

group = "com.github.RaiderRobotix"
version = "v4.0.0-alpha"

repositories {
maven { url 'https://jitpack.io' }
jcenter()
}

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

jar {
manifest {
attributes (
'Implementation-Title': 'Raider Robotix Scouting Client',
'Implementation-Version': project.version,
'Main-Class': 'org.usfirst.frc.team25.scouting.client.ui.Main'
)
}
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
}


dependencies {
implementation 'com.github.RaiderRobotix:Scouting-Models:29617b7dcc'
implementation 'com.github.RaiderRobotix:blue-alliance-api-java-library:3.0.0'

implementation 'org.projectlombok:lombok:1.18.10'
annotationProcessor 'org.projectlombok:lombok:1.18.10'

implementation 'com.google.code.gson:gson:2.+'
implementation 'commons-io:commons-io:2.+'
implementation 'org.apache.commons:commons-math3:3.+'

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.61"

}

buildConfig {
packageName "com.raiderrobotix"
buildConfigField 'String', 'TBA_API_KEY', project['TBA_API_KEY']
// The escaped quotes here are NEEDED. The plugin copies the TEXT LITERAL given to it. The quotes are part of this.
buildConfigField 'String', 'VERSION', "\"$version\""
}

javafx {
version = "11"
modules = [
'javafx.base',
'javafx.graphics',
'javafx.controls',
'javafx.fxml',
]
}

jlink {
launcher {
name = 'Scouting Client'
}
}

application {
mainClassName = 'org.raiderrobotix.scouting.client/org.raiderrobotix.scouting.client.ui.Main'
}

wrapper {
gradleVersion = '6.1.1'
}

compileKotlin {
kotlinOptions {
jvmTarget = "11"
}
}

compileTestKotlin {
kotlinOptions {
jvmTarget = "11"
}
}

最佳答案

我有一个类似的问题,我在 jlink 期间的具体错误是:

Error: Two versions of module javafx.base found in C:\Users\tareh\code\cleopetra\build\jlinkbase\jlinkjars (javafx-base-11.0.2-win.jar and javafx-base-11.0.2-linux.jar)

Execution failed for task ':jlink'.
我从 https://github.com/openjfx/javafx-gradle-plugin/issues/65 得到了一些灵​​感并在 build.gradle 中更改了我的依赖项之一:
dependencies {
// Get rid of this
// compile group: 'org.controlsfx', name: 'controlsfx', version: '11.0.3'

// Use this instead
implementation('org.controlsfx:controlsfx:11.0.3') {
exclude group: 'org.openjfx'
}
}
在我这样做之后,jlink 错误消失了,而且我注意到在我的 IntelliJ 模块依赖项中列出的 linux jar 已经消失了(我在 Windows 上)。
这不能解决您的具体问题,但希望这对其他人有帮助。

关于gradle - gradle/JavaFX 项目中模块 javafx.base 的两个版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60471331/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com