I think it is caused by compileKotlin { destinationDir = compileJava.destinationDir }
.
Try removing it and add "--patch-module", "$moduleName=${sourceSets["main"].output.asPath}"
to the compilerArgs
for compileJava
instead.
I haven’t worked with JPMS and Kotlin yet myself, so I am not sure what the “right” way of going about it is.