简体   繁体   English

将Kotlin配置为IntelliJ中的现有项目

[英]Configure Kotlin to an existing project in IntelliJ

I created a kotlin new Kotlin project through intelliJ ( https://github.com/dhananjay12/kotlin/tree/master/kotlin-basic ) a while back. 我不久前通过intelliJ( https://github.com/dhananjay12/kotlin/tree/master/kotlin-basic )创建了一个kotlin新的Kotlin项目。 I then imported it into IntelliJ from a different machine. 然后,我从另一台计算机将其导入IntelliJ。

There is no run option coming : 没有运行选项即将出现: 在此处输入图片说明

I tried to configure using Project SDK and Libraries, still, IntelliJ doesn't recognize it as a kotlin project. 我尝试使用Project SDK和库进行配置,但IntelliJ仍不将其识别为kotlin项目。 在此处输入图片说明

在此处输入图片说明

NOTE- New project works completely fine 注意-新项目完全正常

How do I configure an existing project to Kotlin? 如何为Kotlin配置现有项目?

What files need to be saved in git so that manually configuring IDE is not required? 哪些文件需要保存在git中,以便不需要手动配置IDE?

1) Right click the src folder 1)右键单击src文件夹

2) Mark directory as Sources Root 2)将目录标记为Sources Root

3) Will ask you to configure Java SDK and Kotlin Plugin for the module. 3)将要求您为该模块配置Java SDK和Kotlin插件。 Do it. 做吧

4) Run & enjoy 4)跑步并享受

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM