Reprint: IDEA lombok install and use plug-ins

Reprinted from: https://jingyan.baidu.com/article/0a52e3f4e53ca1bf63ed725c.html

Plug-in installed lombok

 
  1. 1

    First we need to install lombok IntelliJ IDEA plug-in, open IntelliJ IDEA Click on File in the menu bar -> Settings, or use the keyboard shortcut Ctrl + Alt + S to enter the settings page.

    Installation and use of IntelliJ IDEA lombok plug
  2. 2

    We click on Settings in the Plugins installed widget and choose Browse repositories on the right side ... and enter lombok can change the query to the search page Lombok Plugin below, click on Lombok Plugin can see the Install button on the right, click this button can be installed.

    Installation and use of IntelliJ IDEA lombok plug
    Installation and use of IntelliJ IDEA lombok plug
    Installation and use of IntelliJ IDEA lombok plug
    Installation and use of IntelliJ IDEA lombok plug
  3. 3

    We can see all the notes in the installation page lombok specific support, there are tips Downloading Plugins during installation, the installation progress bar will change. We need to be reminded that, during the installation process must ensure that the network connection is available and good, otherwise it might fail to install. After a successful installation, we can see a Restart button to the right, this time to not operate, because we have a follow-up configuration. After installation is complete, we go back to Plugins, this time on the right side can search for lombok, but before the installation is not acceptable.

    Installation and use of IntelliJ IDEA lombok plug
    Installation and use of IntelliJ IDEA lombok plug
    Installation and use of IntelliJ IDEA lombok plug
    Installation and use of IntelliJ IDEA lombok plug
    END

Configuring annotation processor

 
  1.  

    We set the same page in Settings, we click Build, Execution, Deployment -> select Compiler -> Select the Annotation Processors, and then check the Enable annotation processing to the right.

    Installation and use of IntelliJ IDEA lombok plug
    Installation and use of IntelliJ IDEA lombok plug
  2.  

    Lombok use plug-ins

     
    1.  

      We should be noted that prior to use is to install the plug-in is just a call, just as we use maven plugin, you need to install the machine maven job. We also need to add a dependency lombok before use lombok. Lombok version has been updated, you can enter lombok in the Baidu search box maven find the latest version of dependence.

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

      Installation and use of IntelliJ IDEA lombok plug
    2.  

      Next we edit an entity class Student, add three attributes, and finally add @Data property on the class, this annotation can help get all of the attributes of the class / set methods we generate .class file, equals, canEqual, hashCode, toString methods.

      Installation and use of IntelliJ IDEA lombok plug
    3.  

      So after you finish editing the code generated by the method of how we view it? In the menu bar, click View -> Tool Windows -> Structure, we can see the class all the way, these are automatically generated lombok help me.

      Installation and use of IntelliJ IDEA lombok plug
      Installation and use of IntelliJ IDEA lombok plug
      END

    Precautions

     
    • Lombok plug-in installation process requires networking, you need to configure additional installation Annotation Processors Support.

Reprinted from: https://jingyan.baidu.com/article/0a52e3f4e53ca1bf63ed725c.html

Guess you like

Origin www.cnblogs.com/mySummer/p/11099907.html