admin管理员组文章数量:1400837
My @RequiredArgsConstructor is not working annotation is enabled lombok is installed
removed the imports all imports are ohk nothing wrong there
@Service
@RequiredArgsConstructor
public class PostServiceImpl implements PostService {
private final PostRepository postRepository;
private final ModelMapper modelMapper;
@Override
public List<PostDTO> getAllPosts() {
return List.of();
}
@Override
public PostDTO createNewPost(PostDTO inputPost) {
return null;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns=".0.0" xmlns:xsi=";
xsi:schemaLocation=".0.0 .0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.4.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.codingshuttle.anuj.prod-ready-features</groupId>
<artifactId>prod-ready-features</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>prod-ready-features</name>
<description>Demo project for Spring Boot and prod-ready-features</description>
<url/>
<licenses>
<license/>
</licenses>
<developers>
<developer/>
</developers>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
</scm>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- .modelmapper/modelmapper -->
<dependency>
<groupId>.modelmapper</groupId>
<artifactId>modelmapper</artifactId>
<version>3.2.2</version>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>.projectlombok</groupId>
<artifactId>lombok</artifactId>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
Did all these things
- Added Lombok dependency in pom.xml.
- Verified Lombok is present in mvn dependency:tree.
- Installed the Lombok plugin in IntelliJ IDEA.
- Restarted IntelliJ after installing the plugin.
- Enabled annotation processing in IntelliJ settings.
- Annotated the service class with @RequiredArgsConstructor.
- Rebuilt the project using IntelliJ’s Rebuild Project.
- Ran mvn clean compile from the terminal.
- Checked IntelliJ Alt + 7 Structure tab to confirm constructor generation.
- Validated Lombok dependency version is compatible with Java 17.
- Used Invalidate Caches / Restart in IntelliJ.
- Confirmed manually written constructor works, but Lombok-generated one doesn’t show effect.
本文标签: javaHow can I fix Lombok not working in IntelliJ IDEAStack Overflow
版权声明:本文标题:java - How can I fix Lombok not working in IntelliJ IDEA? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744275569a2598394.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论