Published on

Start from Java instead of Kotlin when Using Kotlin


On a project I have been working on lately we decided to use Kotlin for it. I have used Kotlin in the past where it was added to an existing Java project. In this case we decided to start with a Kotlin project.

This ended up making it more tricky as the setup we used required all Kotlin files to be placed under a Kotlin root and all Java files to be placed under a Java root.

In the end we switched to a pure Java project and used Cmd/Ctrl+Alt+Shift+k in IntelliJ to convert one file which then added the relevant Kotlin gradle/maven plugin to get it to work. The benefit with this approach is that we can now mix Kotlin and Java files under the same java root making it much simpler.