安装Lombok

可能需要先解决sudo java问题

xuej@xuej-VirtualBox:~/Downloads$ sudo java -version
sudo: java: command not found
xuej@xuej-VirtualBox:~/Downloads$ sudo vi /etc/sudoers
xuej@xuej-VirtualBox:~/Downloads$ sudo java -version
sudo: java: command not found
xuej@xuej-VirtualBox:~/Downloads$ sudo vi /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/usr/java/jdk8u332-b09/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d
~                                                                                                                                                                      
xuej@xuej-VirtualBox:~/Downloads$ sudo java -version
openjdk version "1.8.0_332"
OpenJDK Runtime Environment (Temurin)(build 1.8.0_332-b09)
OpenJDK 64-Bit Server VM (Temurin)(build 25.332-b09, mixed mode)

基于IDE安装lombok

xuej@xuej-VirtualBox:~/Downloads$ sudo java -jar lombok.jar

pom依赖

<dependency>
	<groupId>org.projectlombok</groupId>
	<artifactId>lombok</artifactId>
	<version>1.18.24</version>
	<scope>provided</scope>
</dependency>

小结

  1. 可能需要先解决sudo java问题
  2. 执行lombok开启界面指定IDE工具的位置
  3. 记得在项目工程中的pom中引入lombok依赖
  4. IDE安装文档:https://projectlombok.org/setup/eclipse
  5. Build工具安装文档:https://projectlombok.org/setup/maven
  6. Lombok配置文档:https://projectlombok.org/features/configuration