How to Structure Kotlin/Java Project?


I've successfully integrated Kotlin with an existing Java project. I was wondering what the conventions are for structuring a multi-language project.

Right now I have this:


As you can see, Java and Kotlin are coexisting quite nicely, but I’m not sure if this is standard. Should I create a new source root called kotlin instead of java?


One of the goals for Kotlin was to make it co-exist with Java in existent projects, so I think your structure is perfectly fine. In fact we have a similiar tree in Kotlin plugin project. All new code is written in Kotlin and we gradually substitude Java files but we are still using same package structure with separate packages for different features.


For my project, I created a separate kotlin root, and it's also worked well. I think for us, part of why we did this was that the Java codebase was a little bit unruly, so this was an excuse to create a nice clean tree. But as has been said, I don't think there's any inherent problems with combining them.