Package lombok does not exist
Asked Answered
D

8

22

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

Disyllable answered 8/8, 2019 at 2:35 Comment(9)
Is the lombock Jar available in your specific project library? In my IDE, after I add a library, I still have to specify that any given project uses it.Haruspicy
Yes I can see it's there. updated the screenshot in question section.Disyllable
Did you restart IntelliJ after you installed the lombok plugin?Staggard
this answer may help you https://mcmap.net/q/589343/-can-not-find-getter-and-setterHiatt
@IstiaqueHossain followed the same step. but same error,Disyllable
@MattBerteaux Yes, restarted after both the steps-Enable annotation processing and plugin installation.Disyllable
Do you have problems in test classes? There have been some reports that to make that work you need to add lombok and the annotation processor to the test scope as well.Supernatural
Proberbly some dependencies don't meet the current requirements of lomboxAniconic
Does lombox work if you using a current version of IntelliJ ?Aniconic
O
9

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

Originally answered 9/10, 2021 at 11:36 Comment(1)
In my case I needed to add these 2 as well as compileOnly 'org.projectlombok:lombok:1.18.22' for my unit tests to executePacify
A
5

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"
Allyl answered 8/10, 2020 at 11:18 Comment(2)
Import a gradle project as maven project? Doesn't make any sense.Elegize
Yes, close your current project, and reopen it by selecting the pom file. Then open this pom file as a project.Dahabeah
M
3

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>
Mcgannon answered 31/7, 2022 at 15:5 Comment(0)
M
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.

Maretz answered 8/8, 2019 at 2:46 Comment(2)
@Avhi, try following the link I have shared. Worked for me for Eclipse iDE. probably, IntelliJ solution would also work.Maretz
As I have provided the details in question. these both steps has been taken care already. still getting the error.Disyllable
O
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.

Oxygen answered 5/10, 2021 at 17:35 Comment(0)
J
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.

Junina answered 1/3, 2023 at 10:43 Comment(0)
M
-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

Mera answered 25/2, 2021 at 6:0 Comment(1)
While there is an answer to this question, it would be better if the main part of the answer is on the post.Glue
M
-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
Mediant answered 29/6, 2022 at 8:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.