20

I am using IntelliJ IDEA 2018.2.5 (Community Edition). Here are the complete details.

Build #IC-182.4892.20, built on October 16, 2018
JRE: 1.8.0_152-release-1248-b19 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

I have followed all the suggested solutions in so many different answers in SO. but nothing worked for me.

Here are the screenshots of required setting that needs to be done for lombok package.
enter image description here

enter image description here enter image description here

lombok jar is available in external libraries.
enter image description here

I still get the error while compiling the application.
enter image description here

Project Library:
enter image description here

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Avhi
  • 806
  • 2
  • 15
  • 29

8 Answers8

5

In my case, I forgot the test dependency:

testCompileOnly 'org.projectlombok:lombok:1.18.22'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.22'

Gradle 4.10, java1.8, Intellij Idea 2018.3.2

Laurel
  • 5,965
  • 14
  • 31
  • 57
4

I had the same problem, after change git branch in intellij. The solution is:

  1. on project panel (left side) right click on pom.xml file
  2. click on "Add as Maven Project"
flxj
  • 59
  • 4
2

Try to setup the scope directly. Example for maven:

<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <version>1.18.22</version>
    <scope>compile</scope>
</dependency>
Evan
  • 31
  • 2
1

In order for intelliJ to be able to read lombok at compile time, you would have to update annotation processor settings in the IDE and then add the plugin for lombok.

Please refer to this link for details about how to do the above said changes.

Ankur
  • 892
  • 6
  • 11
  • @Avhi, try following the link I have shared. Worked for me for Eclipse iDE. probably, IntelliJ solution would also work. – Ankur Aug 08 '19 at 02:48
  • As I have provided the details in question. these both steps has been taken care already. still getting the error. – Avhi Aug 08 '19 at 02:49
1

I met exactly the same issue, but couldn't let it go after tried all solutions I could found in stackoverflow.

Eventually, I fixed it, by changing Preferences - Build, Execution, deployment > Build Tools > Gradle:

Build and run using: Gradle (Default) // it was Intellij IDEA

Run tests using: Gradle (Default) // it was Intellij IDEA

Gradle JVM: 11 // use 8 and above

Not sure if this is the right answer, but any of you have this issue can try. I believe it's just the IntelliJ setting caused problem.

Ninni
  • 11
  • 1
0

I have tried all the above answers, it didn't work for me. Also I have also tried adding -Djps.track.ap.dependencies=false in so many places but not solved the problem.

Try deleting .idea folder which is inside your project and then after mvn clean install it solved the problem.

-1

Check out this link: https://projectlombok.org/setup/gradle

I had the same problem and resolved it after adding lombok dependencies in build.gradle

-1

for me:

  1. I downmoad "lombok.jar" for origine site "https://projectlombok.org/download".
  2. in intellij IDE, File => Preject Structure => Librairies.
  3. click to button "+" to add librairies => java => file "lombok.jar" that's works for me
Mounir bkr
  • 1,069
  • 6
  • 6