I have a project 'Onboarding' which has another project 'EntityModel' as a dependency. Inside 'EntityModel' have a lot of entities annotated with Lombok, for example:
@NoArgsConstructor
@Getter
@Setter
@ToString
@Entity
@Table(name="address")
public class Address {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "address_generator_sequence")
@Column(name = "address_id")
private long id;
(...)
but when I try to access the getters or setters of those entities in a 'Onboarding' class:
@PostMapping("/createCustomer")
public ResponseEntity<Customer> createCustomer(@RequestBody Customer customer) throws URISyntaxException {
Address ad = new Address();
ad.getId();
return ResponseEntity.created(new URI("/user/")).build();
}
The IDE doesn't show up the getters in the options box, and when I run the build, the compller shows me this:
(...)/Restaurant/onboarding/src/main/java/com/restaurant/onboarding/controller/OnboardingController.java:37: error: cannot find symbol
ad.getId();
^
symbol: method getId()
location: variable ad of type Address
when I opened the .class and realized the annotations didn't persist, I searched a little bit and saw that Lombok has the Retention as a Source. But even so, is there any other way, any other configuration that I can make to access Lombok getters and setters from another project?
After configure the io.freefair.lombok
plugin inside the 'Onboarding' build.gradle.kts, it works:
plugins {
java
war
id("org.springframework.boot") version "3.1.2"
id("io.spring.dependency-management") version "1.1.2"
id("io.freefair.lombok") version "8.1.0"}