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
A simple but effective solution would be to change the two phases (the
element) applied to the executions of the Kotlin Maven Plugin, from compile
to process-sources
and from test-compile
to process-test-sources
.
You want the Kotlin part to be executed before the Java one. Maven by default will invoke the Maven Compiler Plugin as part of the compile
phase for source code, and test-compile
for test code. Moving the Kotlin part to their previous phases would then make the flow as you wished.
If you wanted the opposite (first Java then Kotlin), then you could have moved the Kotlin part to the next phases (as an example: from compile
to process-classes
and from test-compile
to process-test-classes
).
For further details about Maven phases, check the official documentation.