IntelliJ에서 Lombok을 설정하여 사용할 수 있다.

Goal

  • IntelliJ에서 Lombok Dependency 설정하기
  • IntelliJ에서 Lombok Plugin 설정하기
  • IntelliJ에서 Enable annotation 설정하기

1. Lombok Dependency 설정

Maven

<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <version>1.18.4</version>
    <scope>provided</scope>
</dependency>

Gradle

// https://mvnrepository.com/artifact/org.projectlombok/lombok
provided group: 'org.projectlombok', name: 'lombok', version: '1.18.4'

2. Lombok Plugin 설정

  1. 설정
    • Windows: File > Setting (Ctrl+Alt+S)
    • MacOS: Preferences (Cmd + ,)
  2. Plugins 선택 후 Browse repositorie에서 lombok 검색
  3. Lombok Plugin (TOOLS INTEGRATION) Install
  4. IntelliJ Restart

3. Enable annotation 설정

  1. 설정
    • Windows: File > Setting (Ctrl+Alt+S)
    • MacOS: Preferences (Cmd + ,)
  2. Build, Execution, Deployment > Compiler > Annotation Processings
  3. Enable annotation processing 체크

References