I\'m working on a mixed java and kotlin project by using maven.
The problem I\'m facing right now is, maven-compiler-plugin
runs before compiling kotl
Although it's more verbose, you can compile both Java and Kotlin sources in the compile
phase with the following configuration:
kotlin-maven-plugin
org.jetbrains.kotlin
${kotlin.version}
kotlin-compile
compile
compile
kotlin-test-compile
test-compile
test-compile
org.apache.maven.plugins
maven-compiler-plugin
3.5
default-compile
none
default-testCompile
none
java-compile
compile
compile
java-test-compile
test-compile
testCompile
Normally, plugins are executed in the order they are declared in the POM, but the executions of default-compile
and default-testCompile
are special because they're built-in, so they always go first. The above configuration gets around that by disabling the default compile executions, and declaring maven-compiler-plugin
with new compilation executions after the kotlin-maven-plugin
. In this way, you can get all compilation to properly occur during the compile
phase of the build lifecycle.