java 如何在 IntelliJ 上更改 Kotlin 编译器版本?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33287227/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 21:28:45  来源:igfitidea点击:

How can I change the Kotlin compiler version on IntelliJ?

javaintellij-ideakotlinquasar

提问by Jire

In IntelliJ you can set the target Java version like this:

在 IntelliJ 中,您可以像这样设置目标 Java 版本:

enter image description here

在此处输入图片说明

Unfortunately I don't see a place where I can do the same for Kotlin. This makes it not possible for me to use Quasar-Kotlin. I want to switch to M14 even though I have 1.0 beta installed. How can I change back?

不幸的是,我没有看到可以为 Kotlin 做同样事情的地方。这使我无法使用 Quasar-Kotlin。即使我安装了 1.0 测试版,我也想切换到 M14。我怎样才能变回来?

After changing the build.gradlefile back to M14 I am greeted with compilation errors in my project.

build.gradle文件改回 M14 后,我的项目中出现编译错误。

enter image description here

在此处输入图片说明

My build.gradle: https://gist.github.com/Jire/5b517fd767ad498bc18f

我的build.gradlehttps: //gist.github.com/Jire/5b517fd767ad498bc18f

采纳答案by yole

You can't do this at the moment. Building your project in IntelliJ IDEA always uses the version of the Kotlin compiler bundled with the plugin, regardless of what your build.gradle file says. If you need to downgrade to M14, you need to install the M14 version of the plugin.

你现在不能这样做。在 IntelliJ IDEA 中构建项目始终使用与插件捆绑的 Kotlin 编译器版本,无论您的 build.gradle 文件是什么。如果需要降级到M14,则需要安装M14版本的插件。

回答by Defuera

Go to Intellij Preferences -> Build, Execution, Deployment -> Kotlin Compiler. Update Language versionand Api versionto the one you wish.

转到 Intellij 首选项 -> 构建、执行、部署 -> Kotlin 编译器。将语言版本Api 版本更新为您想要的版本

(You can also use cmd+ shift+ Aand type Kotlin Compilerto get to this preference)

(您也可以使用cmd+ shift+A和类型科特林编译器去这个偏好)

enter image description here

在此处输入图片说明

回答by Jeremy Lyman

The kotlin versions are defined in your build.gradle file.

kotlin 版本在 build.gradle 文件中定义。

See the following example :

请参阅以下示例:

build.gradle

构建.gradle