Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. I then imported it into IntelliJ from a different machine.

There is no run option coming : enter image description here

I tried to configure using Project SDK and Libraries, still, IntelliJ doesn't recognize it as a kotlin project. enter image description here

enter image description here

NOTE- New project works completely fine

How do I configure an existing project to Kotlin?

What files need to be saved in git so that manually configuring IDE is not required?

like image 872
Dhananjay Avatar asked Oct 24 '18 05:10

Dhananjay


People also ask

How do I add Kotlin to an existing Java project?

To convert Java code to Kotlin, open the Java file in Android Studio, and select Code > Convert Java File to Kotlin File. Alternatively, create a new Kotlin file (File > New > Kotlin File/Class), and then paste your Java code into that file.

How do I change my project to Kotlin?

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

How do I enable Kotlin plugin in IntelliJ?

The plugin is bundled with IntelliJ IDEA and is activated by default. If the plugin is not activated, enable it on the Plugins page of the IDE settings Ctrl+Alt+S as described in Install plugins. IntelliJ IDEA provides first-class support for Kotlin.


1 Answers

1) Right click the src folder

2) Mark directory as Sources Root

3) Will ask you to configure Java SDK and Kotlin Plugin for the module. Do it.

4) Run & enjoy

like image 167
abitcode Avatar answered Nov 09 '22 04:11

abitcode