当使用intellij idea构建kotlin项目时,到处都有许多选项似乎在指定目标jvm版本。我已经附加了每个项目当前显示在我的项目中的值:
Settings > Build, Ex, Dep > Compiler > Kotlin Compiler > Target JVM version (1.6)
- (above page shows warning: Following modules override project settings: MyProject.main, MyProject.test)
Settings > Build, Ex, Dep > Compiler > Java Compiler > Project bytecode version (13)
Settings > Build, Ex, Dep > Build Tools > Gradle > Gradle JVM (Project SDK 13)
Project Structure > Project Settings > Project > Project language level (SDK default)
Project Structure > Project Settings > Modules > [project name] > [main] > Kotlin > Target platform (JVM 1.8)
Project Structure > Project Settings > Facets > Target platform (Multiplatform)
(in build.gradle.kts file) tasks.withType<KotlinCompile> { kotlinOptions.jvmTarget = "11" }
这是对我可以指定jre的各种地方的补充:
Settings > Build, Ex, Dep > Build Tools > Maven > Runner > JRE (Use Project JDK)
Project Structure > Project > Project SDK (13 java version "13.0.2")
Project Structure > Project Settings > Modules > [project name, or main, test, etc] (Project default)
以上哪项设置具有最高优先级?如果我想将我的程序编译为目标jvm版本11,那么哪个设置是必需的,并且不会被其他设置覆盖?
1条答案
按热度按时间o2rvlv0m1#
在基于maven的jvm项目中,要设置目标jvm版本-使用maven意味着-ide将自动选择以下设置:
或:
另请参见在maven中指定java版本-属性和编译器插件之间的差异