I have started to work on a Micronaut REST microservice, with Kotlin and Maven, and I have a hard time at trying to get the better build process possible with this stack in Intellij.
I was expecting Kotlin to be easily compatible with Micronaut, but at each code modification we have to do a compilation of the project (mvn compile) due to use of KAPT plugin to process the Micronaut annotations with Kotlin, which seems to be time consuming.
This post helped me to get a good solution to compile Kotlin with Micronaut and Gradle by making it automatized in Intellij: IntelliJ - Gradle - Kotlin - Micronaut - Changing files does not re-generate classes on "run" (the equivalent can be done for Maven with the same corresponding option)
Thanks to the Micronaut CLI, I have generated three hello-world projects to compare the build durations. Here are the commands to create them:
mn create-app micronaut-maven-kotlin --build maven --lang kotlin
mn create-app micronaut-maven-java --build maven --lang java
mn create-app micronaut-gradle-kotlin --build gradle --lang kotlin
I measured approximatively the duration of build process before Intellij run the project code, here are the results:
- Java + Maven = no waiting
- Kotlin + Gradle = 2.5 seconds
- Kotlin + Maven = 8 seconds
The apps takes 1 second to start. With Java, Micronaut is blazing fast to work with, but this argument no longer exists when I'm introducing Kotlin in the pipe, and I'm afraid of doing it with a bigger project...
Did anybody succeed to have a convenient process with Micronaut, Kotlin and Maven?