kotlin - 在 IntellijIDEA 中编译 Kotlin:“类路径中的某些运行时 JAR 文件的版本不兼容。考虑将它们从类路径中删除”
问题描述
这是一大组可能的交互配置可能性,所以我想知道我要更改哪个。
设置:
- IntellijIDEA 2020.3
- Kotlin 插件 1.4.32
- 已选择 Gradle 构建
- 构建/运行时 JDK 采用 OpenJDK 11
- 我也在尝试引入 JavaFX(即真正的 OpenJFX 16)
- 我也在尝试引入 TornadoFX
- 为桌面编译,而不是 Android
构建成功,我成功获得了一个列表窗口。
但是,执行“重建项目”时会给出以下警告:
> Task :compileKotlin
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
/home/rost/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/1.4.32/ce852b166d97f0f1991b5130c2bb02e2ef6c554e/kotlin-reflect-1.4.32.jar (version 1.4)
/home/rost/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.3.61/e91d61b7cfd9a45566b580fef18bbd5c32d505b5/kotlin-stdlib-jdk8-1.3.61.jar (version 1.3)
/home/rost/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.3.61/70dffc5f8ac5ea7c34f30deac5b9d8b1d48af066/kotlin-stdlib-jdk7-1.3.61.jar (version 1.3)
/home/rost/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.4.32/461367948840adbb0839c51d91ed74ef4a9ccb52/kotlin-stdlib-1.4.32.jar (version 1.4)
/home/rost/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.4.32/ef50bfa2c0491a11dcc35d9822edbfd6170e1ea2/kotlin-stdlib-common-1.4.32.jar (version 1.4)
w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath
所以,
类路径中的某些运行时 JAR 文件的版本不兼容。考虑将它们从类路径中删除
我喜欢看到“没有警告”的情况,所以......我在哪里做这个?
我想有一些配置元素要添加到 Gradle 构建文件中(我还没有熟悉 Gradle)
构建文件现在如下:
// https://www.jetbrains.com/help/idea/javafx.html
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.4.32'
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.8'
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.32"
implementation "org.jetbrains.kotlin:kotlin-reflect:1.4.32"
implementation "org.jetbrains.kotlin:kotlin-stdlib-common:1.4.32"
}
javafx {
version = "16"
modules = ['javafx.controls', 'javafx.graphics']
}
dependencies {
implementation 'no.tornado:tornadofx:1.7.20'
}
compileKotlin {
kotlinOptions.jvmTarget = "11"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "11"
}
解决方案
推荐阅读
- reactjs - useContext 中的 Provider 是否持有多个值
- android - 如何从 api 验证 otp
- java - 在Java中获取值时如何实现线程安全的HashMap延迟初始化?
- c# - 为什么父任务在他的子任务之前完成?
- django - django 用字段比较结果注释查询集
- node.js - express.js 路由行为
- django - 基于多租户架构的两个docker容器之间的通信
- mysql - SQL 查询从一个表返回记录,这些记录与另一个表中的 2 条记录相关联
- security - 如何使 dokku 仅将应用程序部署到 https 连接
- snowflake-cloud-data-platform - 在 VALUES 子句中使用 REPEAT/SPACE 的雪花