how to specify maven compiler plugin order

前端 未结 4 859
故里飘歌
故里飘歌 2021-02-10 17:29

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

4条回答
  •  盖世英雄少女心
    2021-02-10 17:51

    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.

提交回复
热议问题