Solution to lombok not taking effect in IDEA

Table of contents

Preface: An error was reported when springboot started, saying that there was no lombok compiler

Step 1: Check if the plugin lombok exists

Step 2: View the lombok version officially recommended by springboot

-> 2.1 The first step is to find the parent ctrl and click in

-> 2.2 Enter in the red box

-> 2.3 ctrl+f search for lombok.version and copy this version

-> 2.4 Modify your dependency to the version shown above to refresh maven and restart 

Step 3: Find a configuration

-> Generally, it is not necessary. The default is to check the status and uncheck the check and then ok

​Edit Step 4: The last three steps are not easy to use, so the most critical step

-> 4.1 Add the configuration as shown in the figure


Preface: An error was reported when springboot started, saying that there was no lombok compiler

 -> Let’s briefly talk about the role of lombok

  1. Automatically generate getter, setter, toString, equals and other methods, which can reduce the amount of code and duplication of work for developers.

  2. Simplify the writing of construction methods, and annotations can automatically generate construction methods with no parameters or all parameters.

  3. Code that can automatically generate log output.

  4. Chain programming is supported, and the return value of the setter method can be automatically generated through annotations to facilitate method chain calls.

  5. Support annotations to generate code in the Builder mode, which can generate a Builder class for building instances of the target class.

In general, Lombok can help Java developers reduce the amount of code written, improve efficiency, optimize code structure, and thus focus more on the implementation of business logic.

 -> Solution

The solution is to go in four steps , look at it step by step, and look directly at the fourth step in a hurry, 

This article is enough (if this article can't be solved, it's similar to other searches) ,

Solve 99% of lombok ineffective problems

Step 1: Check if the plugin lombok exists

 After checking, it is found that it has been installed normally, continue, just look at the fourth step in a hurry , if not, then look at the second and third steps

Step 2: View the lombok version officially recommended by springboot

-> 2.1 The first step is to find the parent ctrl and click in

    <parent>
        <artifactId>spring-boot-starter-parent</artifactId>
        <groupId>org.springframework.boot</groupId>
        <version>2.3.2.RELEASE</version>
        <relativePath/>
    </parent>

-> 2.2 Enter in the red box

 

-> 2.3 ctrl+f search for lombok.version and copy this version

<commons-lang.version>3.8.1</commons-lang.version>
<alibaba.fastjson.version>1.2.75</alibaba.fastjson.version>
<lombok.version>1.18.14</lombok.version>
<poi.version>3.17</poi.version>
<ant.version>1.8.2</ant.version>
<javax.validation.version>2.0.1.Final</javax.validation.version>
<hibernate.validator.version>6.1.5.Final</hibernate.validator.version>
<jackson-core.version>2.11.2</jackson-core.version>
<ipaddress.version>5.1.0</ipaddress.version>
<freemarker.version>2.3.28</freemarker.version>

-> 2.4 Modify your dependency to the version shown above to refresh maven and restart 

<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <version>1.18.12</version>
</dependency>

Step 3: Find a configuration

-> Generally, it is not necessary. The default is to check the status and uncheck the check and then ok

 Step 4: The last three steps are not easy to use, so the most critical step

-> 4.1 Add the configuration as shown in the figure

-Djps.track.ap.dependencies=false

Click ok to restart the project

ps: The Rebuild module on dependency change above needs to be checked

Introduce the meaning of the above configuration: 

Use the build process "jps.track.ap.dependencies" VM flag to enable/disable the incremental annotation processing environment.

If true, it may cause version incompatibility issues


 Most of lombok is a version incompatibility problem, just change the version

Try the above method once if it still doesn't work clear the cache restart or refresh maven and try again

Guess you like

Origin blog.csdn.net/pingzhuyan/article/details/130867113