How to use Lombok plugin in IntelliJ 2021.2.2?
Asked Answered
O

3

2

I am new to Java from c++ and I have been trying to familiarise myself with the language. I am trying to use the lombok plugin from IntelliJ IDEA but it does not seem to work for me at all:

This is a screenshot of my IDEA failing to recognise the "@value" annotation


The lombok is already installed on my IDEA and I have tried restore the default settings of my ide a bunch of times but I still get the same error:

This is a screenshot of the lombok plugin install on my ide

I am using the IntelliJ IDEA 2021.2.2 (Ultimate Edition). Does anyone know what's the problem?

Oath answered 27/9, 2021 at 0:18 Comment(1)
It's @Value not @valueCareful
P
4

I have never used the Lombok plugin through the IDE. The way I do know how to use it is as follows:

  1. Make sure that when you create a new project through your IDE that you're selecting either a maven project or a gradle project, these are project types that help you manage your dependencies in an intuitive way(I'll use maven for this example). Maven or Gradle project

  2. Go to either https://projectlombok.org/setup/maven or https://projectlombok.org/setup/gradle depending on the project type you've chosen you'll have to copy and paste the text block from these respective url's into either your pom.xml file(for maven) or your build.gradle file(for gradle)

For Maven: enter image description here

For Gradle: enter image description here

  1. Paste the text block into your pom.xml or build.gradle like so(don't forget to click the M that shows up that's hovered over by the cursor, this updates your project with the new dependency so you can use actually use lombok): enter image description here

  2. Now you should be able to use Lombok and make use of all it's boilerplate goodness :) enter image description here

Poultice answered 27/9, 2021 at 1:36 Comment(0)
T
0

I've been run into this issue, it was caused by Lombok version conflict, using the latest version works for me, you can use maven helper idea plugin to see if it's the same case for you.

Teliospore answered 24/3, 2022 at 12:15 Comment(0)
I
0

I came across the same issue and found an intellij IDEA plugin called Delombok. It seems this plugin is part of the projectlombok. Anyone facing the same issue can try it out! By the way I am using IntelliJ IDEA 2022.1.4 (Ultimate Edition).

Delombok

Inkling answered 14/8, 2022 at 6:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.