3

I've added Lombok maven repository in my project and successfully use the Lombok annotations. And I tried to access the setter and getter methods from another class but couldn't access those methods. I'm using spring Boot version 2.1.1 and STS. Here is my simple code snippet.

@Entity
@Table(name = "role")
//@Data
@ToString
public class Role {

    @Id @GeneratedValue(strategy=GenerationType.AUTO)
    @Column(name="role_id")
    private int id;

    @Column(name="role")
    @Getter @Setter(AccessLevel.PUBLIC)
    private String role;        
}
2
  • install the plugin to let your IDEA be aware of Lombok Commented Jan 3, 2019 at 7:51
  • But he is not using IDEA...
    – dcalap
    Commented Jan 3, 2019 at 7:59

1 Answer 1

4

You should install it in your STS. Follow the instructions:

Double-click lombok.jar (downloadable from here, or from your maven repository; it's the same jar). This starts the eclipse installer which will find eclipse (and eclipse variants as listed above), and offers to install lombok into these eclipse installations. The same tool can also uninstall lombok:

enter image description here

You can check if your eclipse installation is lombok-enabled in eclipse's about dialog. The lombok version will be listed at the end of the copyright text:

enter image description here

Source: https://projectlombok.org/setup/eclipse

Hope it helps.

2
  • Edited with the essential parts of the answer.
    – dcalap
    Commented Jan 3, 2019 at 8:31
  • for ubuntu you can run the jar java -jar lombok.jar and specify location. Commented Nov 6, 2022 at 4:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.