I have a backend service written in Java using Spring Boot as a framework and with help of Lombok as an annotation processor (to generate boilerplate code) that I build using Gradle. I would like to introduce Kotlin into that service in an incremental and quite conservative way. Namely, I would like to rewrite controllers, when opportunity appears, then the code that is used by those controllers and so on downwards the call stack, until whole service is rewritten. Also, I would like to keep strict dependency rule: in no way would my Java code call Kotlin code.
In regard to Gradle, I would like my Java code to be compiled first and only by Java compiler. I don't want the Kotlin compiler to touch this code, but only to rely on compiled classes. I tried to use Kotlin plugin for Gradle (org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21) but it affects my build in such a way that task compileKotlin appears first
Found task graph: org.gradle.execution.taskgraph.DefaultTaskExecutionGraph@782f578b
Found 29 tasks.
task ':compileKotlin'
task ':compileJava'
I would like it to be more like
task ':compileJava'
task ':compileKotlin'
Can I establish the order of compilation tasks such that Java is compiled first in a single-module Gradle project? Is making two separate modules the only choice available?