#Lombok @Builder error
124 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @modern plume! Please use
/closeor theClose Postbutton above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Ikr
I'm going insane atp there's always some fucking bug everyday 😿
so here's where I'm using it ``` private Book mapToBook(BookDto bookDto) {
if(!BookServiceUtils.isBookDtoValid(bookDto)) {
return null;
}
return Book.builder()
.author(bookDto.getAuthor())
.title(bookDto.getTitle())
.category(bookDto.getCategory())
.pages(bookDto.getPages())
.quantity(bookDto.getQuantity())
.build();
}```
do u still have the old dependency setup for lombok
and here's the Book entity @Entity @NoArgsConstructor @AllArgsConstructor @Getter @Setter @Builder @Table(name = "book", uniqueConstraints = { @UniqueConstraint(columnNames = "title") }) public class Book { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(nullable = false) private Long id; @Column(nullable = false) private String author; @Column(nullable = false) private String title; @Column(nullable = false) private String category; @Column(nullable = false) private Integer pages; @Column(nullable = false) private Integer quantity; }
l0l
Ikr
oops
wrong message
when u format code
do 3 ticks and type java
at the beginning of the message
so it has color
look
@Entity
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@Builder
@Table(name = "book", uniqueConstraints = {
@UniqueConstraint(columnNames = "title")
})
public class Book {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(nullable = false)
private Long id;
@Column(nullable = false)
private String author;
@Column(nullable = false)
private String title;
@Column(nullable = false)
private String category;
@Column(nullable = false)
private Integer pages;
@Column(nullable = false)
private Integer quantity;
}
anyway
you probably dont need to specify nullable false on each field
instead you could do validation on the fields when you are creating the entity
next
show the pom file with lombok setup
Please format your code & make it more readable.
For the java programming language, it should look like this:
```java
public class Main {
public static void main(String[] args){
System.out.println("Hello World!");
}
```
• These are backticks, not quotes.
for some reason it's not letting me post the pom.xml file
I'm getting some discord error
instead of that table annotation
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>```
oh it worked this time
unbelieveable
truly crazy right
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>21</source>
<target>21</target>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>```
it's basically the same as the one we were figuring out yesterday
ye
idk I have dementia
lmaoo
ok wait ill check something
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
is this part new or no i forgot
nvm its not new
ok so if you can try to get rid of the all args constructor
annotation
and see if that helps
that didn't work
did u import the right builder package btw lmao
ha
wtf does that even mean
it says you need
no args constructor
and all args constructor
if i remember correctly
yeah I added them back and I'm still getting the error
yeah
do you know how to run maven clean install
ye I did that like 50 times during past hour
how do u do that
ye ye
ok click it
and at the top u should see the refresh icon
that once u hover on it should say
refresh all maven projects
so click it
holy fuck it works
bruh I thought mvn clean install will take care of all that
the builder method
I'd get u a donut or something for the help but idk where u are and Im from Poland
so I can give you some pierogi
they're good asf
I like absolut vodka, not sure if it's even polish lol
I once drank vodka and beer at the same time and threw up
so don't make the same mistake as me
o mamma mia
but yea if u wanna know why mvn clean install didnt help ask his sudoness daniel
cuz idk how to explain that one in detail
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
