简体   繁体   English

如何在 IntelliJ 中不使用 gradle 执行 Kotlin main

[英]How to not use gradle in IntelliJ to execute Kotlin main

I created a simple Kotlin project with the Console template in IntelliJ and running it I am getting the gradle-symbol in the run-toolwindow (cf. picture).我使用 IntelliJ 中的控制台模板创建了一个简单的 Kotlin 项目并运行它,我在运行工具窗口中获得了 gradle-symbol(参见图片)。

在此处输入图像描述

Usually I see in other tutorials that there is the Kotlin symbol so no gradle is used to run the main of the Kotlin-project.通常我在其他教程中看到有 Kotlin 符号,所以没有 gradle 用于运行 Kotlin 项目的主体。

Is there any possibility to change the way to run a Kotlin-main (despite the run configurations, which I took a look at, but did not find a way to change the "run-environment")是否有可能改变运行 Kotlin-main 的方式(尽管我查看了运行配置,但没有找到改变“运行环境”的方法)

I tried the solution:我尝试了解决方案:

CTRL + ALT + S to enter Settings > Build, Execution, Deployment > Build Tools > Gradle , switching Build and run using to IntelliJ IDEA , then getting the problem: CTRL + ALT + S 进入Settings > Build, Execution, Deployment > Build Tools > Gradle ,将Build and run using切换到IntelliJ IDEA ,然后得到问题:

在此处输入图像描述

Which is closer, but now it seems to get a problem as in Java, what I thought in Kotlin is no problem to have different file names then the actual code-content of the file.哪个更接近,但现在似乎在 Java 中遇到了问题,我在 Kotlin 中认为,文件名与文件的实际代码内容不同是没有问题的。

As described in Configure the build and run actions topic use Settings (Preferences on macOS) |配置构建和运行操作主题中所述,使用设置(macOS 上的首选项)| Build, Execution, Deployment |构建、执行、部署 | Build Tools |构建工具 | Gradle | Gradle | Build and run using: option and switch it to IntelliJ IDEA :使用: 选项构建和运行并将其切换到IntelliJ IDEA

在此处输入图像描述

CTRL + ALT + S to enter Settings then in the left panel choose Build, Execution, Deployment > Build Tools > Gradle , find Build and run using and pick IntelliJ IDEA CTRL + ALT + S 进入Settings然后在左侧面板中选择Build, Execution, Deployment > Build Tools > Gradle ,找到Build and run using并选择IntelliJ IDEA

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 IntelliJ IDEA:如何在 Kotlin 中指定主类? - IntelliJ IDEA: How to specify main class in Kotlin? 如何在 Intellij IDEA 中使用 Gradle 创建 Kotlin 控制台应用程序 - How to create a Kotlin console application with Gradle in Intellij IDEA 如何为 IntelliJ IDEA Gradle 插件设置 Kotlin PSI? - How to set up Kotlin PSI for IntelliJ IDEA Gradle Plugin? 如何使用 Gradle 和 IntelliJ 在 Kotlin 多平台项目中配置 JUnit 5? - How to configure JUnit 5 in a Kotlin multiplatform project using Gradle and IntelliJ? 如何在IntelliJ中运行Kotlin Koans? 什么是“主类”? - How to run Kotlin Koans in IntelliJ? What is the “Main class”? 如何通过 Bukkit/Spigot 插件使用 Kotlin 和 Gradle - How to use Kotlin with a Bukkit/Spigot plugin and Gradle 如何使用Gradle在AppEngine项目中使用Kotlin - How to use Kotlin in AppEngine projects using Gradle Gradle 可以在没有 main() 的情况下执行 TornadoFX 应用程序,而 IntelliJ 不能……为什么? - Gradle can execute TornadoFX app without main() while IntelliJ can't…why? 如何在用 Kotlin 编写的 Intellij IDEA Gradle 插件项目中包含 Kotlin PSI 类(例如 KtClass)? - How to include Kotlin PSI classes (e.g. KtClass) in Intellij IDEA Gradle plugin project written in Kotlin? 如何在主线程上使用 Kotlin 协程 await() - How to use Kotlin coroutines await() on main thread
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM