简体   繁体   English

如何修复:Lombok builder() 方法似乎无法在 IntelliJ 中识别?

[英]How to fix: Lombok builder() method does not seem to be recognised in IntelliJ?

I am not sure what am I doing wrong.我不确定我做错了什么。 Can somebody please help me out有人可以帮帮我吗

POM:聚甲醛: 在此处输入图像描述

Implementation:执行: 在此处输入图像描述

Using it as below:使用它如下: 在此处输入图像描述

The builder() method does not seem to be recognised.似乎无法识别 builder() 方法。 I am using IntelliJ.我正在使用 IntelliJ。 Is there something that I am missing?有什么我想念的吗?

Below are my intelliJ settings:以下是我的智能设置:

IntellijSettings - 1

IntellijSettings - 2

Assuming you use IntelliJ: You have to install Lombok Plugin in order to make it work:假设您使用 IntelliJ:您必须安装Lombok 插件才能使其工作:

  1. Go to File > Settings > Plugins Go 到File > Settings > Plugins
  2. Click on Browse repositories...单击浏览存储库...
  3. Search for Lombok Plugin搜索Lombok Plugin
  4. Click on Install plugin点击安装插件
  5. Restart IntelliJ IDEA重启 IntelliJ IDEA

Aside from the dependency in the provided scope you have to enable the annotation processing (if you are using IntelliJ Idea) and install the Lombok Plugin .除了provided的 scope 中的依赖项之外,您还必须启用注释处理(如果您使用的是 IntelliJ Idea)并安装Lombok 插件

  1.  <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>${lombok.version}</version> <scope>provided</scope> </dependency>
  2. Annotation processing: Navigate to File -> Settings -> Build, Execution, Deployment -> Compiler -> Annotation Processors and check Enable annotation processing .注释处理:导航到File -> Settings -> Build, Execution, Deployment -> Compiler -> Annotation Processors并选中Enable annotation processing

    在此处输入图像描述

  3. Lombok Plugin: Navigate to File -> Settings -> Plugins and make sure the Lombok plugin is installed. Lombok 插件:导航到File -> Settings -> Plugins并确保安装了 Lombok 插件。

    在此处输入图像描述

  4. Restart IntelliJ Idea - The most likely missed part:)重启 IntelliJ Idea -最有可能遗漏的部分:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM