-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] 'Symbol' not recognized. Getters and Setters. #3804
Comments
Here I'm with same problem as @patrickfeeney03, I tried several projects with spring boot 3.4.1, java 21, maven h2/postgres/mysql, jpa/hibernate, kafka and so on.. but org.projectlombok:lombok:1.18.36 is no longer working properly. |
Try commenting out what I commented out in my pom. May help you. For now ... |
Это сработало, но не уверен, почему именно. Возможно, дело в зависимости или конфигурации, которую я добавил, но я не разбирался в этом глубже. <dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>annotationProcessor</scope>
</dependency>
|
I have the same problem.And my project uses idk 17, when I run 'mvn clean install' ,all the getters and setters can't be found.i tried everything on the web but none of them are helpful.I am afraid I have to use jkd1.8 and springboot2 for a probably well functioned Lombok or just write all the getters and setters by myself 😭 |
try to do what I did. It's at the very top of this, in the pom file. lmk |
I didn't have problems using Lombok in simple java proyects but when I used it with Spring I got the problem and fixed it using this :
|
org.projectlombok
lombok
annotationProcessor
even using this not solving my issue help me to do what to do ? |
For JDKs <= 22 without modules you can simply include lombok as a provided or optional dependency and you are done. Everything works out of the box. For projects using modules you have to explicit enable lombok by adding it to the If you use a JDK >= 23 you have to use the module version or set @Brando333 @dinmukhamed1729 There is no |
When I added in pom.xml, it stay red. mouse over shows: Cannot resolve symbol 'annotationProcessor' |
In older versions of Maven (or the maven-compiler-plugin), the annotationProcessor attribute is not a valid scope. The standard scopes in Maven are: compile, provided, runtime, test, and system. If you use a version of Maven or the Compiler Plugin older than 3.5, the element does not exist, and attempting to use annotationProcessor will fail because Maven does not recognize it. Ensure you are using Maven 3.6+ and maven-compiler-plugin 3.5+. |
@Brando333 No, there is no scope like this, the maven version doesn't matter. See https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope for a full list of scopes. |
Попробуй это походу дело в том что нужно связать mupstruct и lombok <dependencies>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>1.6.0.Beta2</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.32</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-mapstruct-binding</artifactId>
<version>0.2.0</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
<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.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>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.4.0-b180830.0359</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.6.0.Beta2</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.32</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-mapstruct-binding</artifactId>
<version>0.2.0</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build> |
Describe the bug
Getters and setters are not being created. Seems to work fine until compilation. If I comment out a plugin in the Pom file the issue goes away. This has happened to other colleagues recently (last week).
To Reproduce
Create a Spring project with Maven and Java 21. With dependencies Spring Boot DevTools, Lombok, Spring Web, JDBC API, Spring Data JPA, MySQL Driver, Spring for RabbitMQ, Validation, CycloneDX SBOM support, Cloud Bootstrap, OpenFeign.
This is the Pom that I am using. You can see the commented out lines. If I don't do this I will get errors saying java: cannot find symbol symbol: method getName(). For all of setters and getters that are supposed to be created with Lombok @DaTa
Usage example:
user.setName(signUpRequest.getName());
Expected behavior
I expected that after creating the project using the generation provided by Intellij I would be able to use the setters and getters from Lombok. I did not manually modify the POM.
The text was updated successfully, but these errors were encountered: