java: cannot find symbol symbol: method builder()
before you ask, I've already enabled annotation processing in my spring boot project. I don't really know what else I can do
103 Replies
ā
This post has been reserved for your question.
Hey @IamMax420! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button 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.
Are you using JDK 23?
Are you using a version of Lombok that's less than 1.18.36?
If the answer to both of these is yes, you need to update Lombok
https://stackoverflow.com/a/79210588/10871900 (yes, I answered that)
Stack Overflow
Build Failure: @Data Annotation won't regonize by Maven
I consider that my maven has problems with the annotation @Data from lombok.
About the project: Java 23 Spring Boot Version 3.3.4 also using Intellij ultimate
The error appears after like mvn comp...
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.36</version>
<scope>provided</scope>
</dependency>
still getting the same error...you probably need to add
<proc>full</proc>
to the maven-compiler-plugin <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</path>
</annotationProcessorPaths>
<proc>full</proc>
</configuration>
</plugin>
Idk if this is right
but I'm still getting the errorcan you show the method at which ur getting the error
š±
Can you show your full pom.xml?
maybe its just wrong syntax
The error is lombok not running
lombok is known for that
might be also cuz lombok is not updated
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.36</version>
<scope>provided</scope>
</dependency>
still getting the same error...happens to me all the time when updating plugins
Can you show the output of
mvn help:effective-pom
?yeah
it normally happens when updating the JDK, not when updating plugins
try explicitly setting the version of the
maven-compiler-plugin
to 3.13.0i mean
if lombok wasnt recognizing the annotation at all
it should be underlined
no
that would be if javac didn't recognize the annotation
the error is lombok not correctly processing it
or syntax error at the calling method
which happens all the time with lombok cause it uses unsupported operations
cuz we havent seen the actual code yet
did that, still getting the error..
Can I see that?
Bug ID: JDK-8321314 Reinstate disabling the compiler's default acti...
Component: tools | Sub-Component: javac
private UserDto mapToUserDto(User user) {
return UserDto.builder()
.id(user.getId())
.firstName(user.getFirstName())
.secondName(user.getSecondName())
.email(user.getEmail())
.createdAt(user.getCreatedAt())
.updatedAt(user.getUpdatedAt())
.build();
}
this is the methodoops wrong gif
umm what directory do I run that command in
the project directory
or in maven console
did you make sure to add the builder annotation to userdto btw
yes
or superbuilder
bro I'm too slow
I go to the project directory and I can't run that
What happens when running it?
mvnw.cmd : The term 'mvnw.cmd' is not recognized as the name of a cmdlet, function, script file, or operable program. C
heck the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ mvnw.cmd help:effective-pom
+ ~~~~
+ CategoryInfo : ObjectNotFound: (mvnw.cmd:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Suggestion [3,General]: The command mvnw.cmd was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\mvnw.cmd". See "get-help about_Command_Precedence" for more details.
which IDE are you using?
are you using intellij
yes
intellij idea community edition
Press Ctrl twice
and then enter
mvn help:effective-pom
in the dialog that pops upyea try that
I hope they haven't changed that keybind in the last few years
ooooh
ok I got some logs
Can you show it?
Specifically the XML
Is there a lombok dependency in it?
I think you can use ctrl+F to search for it
I'm looking for it
yeah
<lombok.version>1.18.36</lombok.version>
meanwhile having "lmao" in the name - lmao
sry I had to make that joke
no problem
nahh man fuck this, I'm still getting this error
It's 11 pm in Poland and I have yet to work out
here its a mental workout
thanks for your guys' help I'll get some sleep, wake up, look at it at probably spot the solution
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.
justas usual
Can you show the actual
<dependency>
as well as the maven-compiler-plugin
in the <plugins>
section of the effective POM?
I'm in Austria so it's the same time for me ;)i was in roblox austria once
we were shooting guns
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<executions>
<execution>
<id>default-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.36</version>
<scope>provided</scope>
</path>
</annotationProcessorPaths>
<proc>full</proc>
<parameters>true</parameters>
</configuration>
</execution>
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.36</version>
<scope>provided</scope>
</path>
</annotationProcessorPaths>
<proc>full</proc>
<parameters>true</parameters>
</configuration>
</execution>
</executions>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.36</version>
<scope>provided</scope>
</path>
</annotationProcessorPaths>
<proc>full</proc>
<parameters>true</parameters>
</configuration>
</plugin>
this?Actually there are other things you could try:
- Compile it via
mvn clean verify
and check for the same error
- Check whether there is a plugin named "Lombok" installed in IntelliJ (it should be there by default but better to be safe)
- If that plugin has an update, update it
- Update IntelliJ
yes, exactly this
and it looks fineha
i will be so right
feel free to check these tomorrow
if it wont work because of the lombok update
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project Kanban: Unable to parse configuration of mojo org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile for parameter scope: Cannot find 'scope' in class org.apache.maven.plugin.compiler.DependencyCoordinate -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
ohhhh
remove the
scope>provided</scope>
in the <annotationProcessorPaths>
then update the Maven project in IntelliJ
maybe IntelliJ calls it "reloading"how?
Is there a reloading symbol (with an "m") in the editor?
Is there a "Maven" tab on the right?
If yes, click it
yea and the first icon in the list
is to refresh
If yes, open it. There should be a reload symbol on the top left of that tab. Click it.
mvn clean install could work too ig
Also you could try running
mvn clean verify
again (via double-ctrl again)
No, don't mvn install
install
bad in most cases
listen to Maven devsyeah so I clicked the reload icon and ran that command, still getting the aforementioned error
install
adds it to the local repointeresting
the compiler error about
builder()
not existing?
Can you try mvn clean verify
again?
And show your current pom.xml again as well?oh shit it doesn't exist
maybe it for real is a wrong version of lombok
I mean the builder() error is no moroe
what exactly?
ah ok
nice
ig it works now?
but I'm still getting this
not sure if this is big of an issue
btw thanks a lot guys
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.
After removing the
<scope>
?
yes, it isyeah
it means your pom.xml is invalid
Are you getting that exact error?
Can you show your full pom.xml?
100 bucks that its lombok version being incompatible
in the plugins tab in project settings there should be an option to update it
I deleted the <scope> tag from here:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
try to see if its there
you still have the
<scope>provided</scope>
settings plugins
huh
I was talking about the
<annotationProcessorPaths>
in the maven-compiler-plugin
ah
my bad
The
<scope>provided</scope>
was fine in the <dependency>
either way it works now
no errors
yaayy
lol
š±
o ma gawd
it wasn't a compatibility issue ;)
š¤
next time it will be
time to donate the 100 bucks i lost
will do
š¤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.