Annotation Processor in IntelliJ and Gradle

前端 未结 4 1525
终归单人心
终归单人心 2020-12-17 09:18

tl;dr: I cannot configure IntelliJ to generate the java files in the same directory as gradle

I have a small project which uses the immutables annot

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-17 09:32

    Hey there everyone I had the same issue and found a clean way of solving this issue. I am using two libraries that require annotation processing (Lombok and MapStruct).

    Also my IntelliJ is 2019.1 (update yours in case it's older) and Gradle 5.2.1.

    First let's configure IntelliJ:

    1. Disable Annotaion Processing in Settings, since we're going to delegate everything to Gradle:

    1. Delegeate IDE actions to Gradle:

    Last step is to configure your dependencies correctly in Gradle.

    1. Dependencies section in Gradle:

    Now you can execute the Build and Run from both command line and IDE.

    Cheers!

提交回复
热议问题