4

I like using Lombok, but it requires enabling annotation processor in IDEs settings. Because developers use different IDEs and CI/CD has it's own compilation flow, plus I would really like to avoid explaining junior devs why do they need to check this checkbox, I am looking for a way to avoid checking this checkbox. Ideally, I would like to let know a junior to run git clone and then ./gradlew run. Is there any way for a Gradle to fully set up annotation processor (without manually clicking)?

It would be really great if it would work on more than IntelliJ IDEA.

The main problem I see is that Lombok requires Lombok plugin installed and activated in IntelliJ IDEA.

Is it possible to run project that uses Lombok by running just: git clone ... && ./gradlew run ?

spam
  • 1,853
  • 2
  • 13
  • 33

1 Answers1

7

You can use the Lombok Gradle plugin
Or you can use it by Gradle dependencies:

dependencies {
    compileOnly 'org.projectlombok:lombok:1.18.8'
    annotationProcessor 'org.projectlombok:lombok:1.18.8'
}

You can read more about Annotation Processor in IntelliJ and Gradle

Daniel Taub
  • 5,133
  • 7
  • 42
  • 72
  • 1
    Setup guide from project lombok -> https://projectlombok.org/setup/gradle – Avinash Kadam Nov 06 '22 at 16:04
  • Specified in dependencies like this, the annotation processor will not run if gradle thinks the tasks are all up to date. Do you know how to forcefully run the annotation processor? (without doing `gradle clean` or `--rerun-tasks` – theonlygusti Jun 18 '23 at 22:20