Lombok and AspectJ

Use ajc to process classes. <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>aspectj-maven-plugin</artifactId> <version>1.11</version> <configuration> <complianceLevel>8</complianceLevel> <source>8</source> <target>8</target> <showWeaveInfo>true</showWeaveInfo> <verbose>true</verbose> <Xlint>ignore</Xlint> <encoding>UTF-8</encoding> <!– IMPORTANT–> <excludes> <exclude>**/*.java</exclude> </excludes> <forceAjcCompile>true</forceAjcCompile> <sources/> <!– IMPORTANT–> <aspectLibraries> <aspectLibrary> <groupId>you.own.aspect.libary</groupId> <artifactId>your-library</artifactId> </aspectLibrary> </aspectLibraries> </configuration> <executions> <execution> <id>default-compile</id> <phase>process-classes</phase> <goals> <!– use this goal to weave all your main classes –> <goal>compile</goal> </goals> <configuration> <weaveDirectories> <weaveDirectory>${project.build.directory}/classes</weaveDirectory> </weaveDirectories> … Read more

Does the Project Lombok @Data annotation create a constructor of any kind?

A @RequiredArgsConstructor will be generated if no constructor has been defined. The Project Lombok @Data page explains: @Data is like having implicit @Getter, @Setter, @ToString, @EqualsAndHashCode and @RequiredArgsConstructor annotations on the class (except that no constructor will be generated if any explicitly written constructor exists).

Lombok and Maven

This might work <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.6.0</version> <configuration> <source>1.8</source> <target>1.8</target> <annotationProcessorPaths> <path> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.16.12</version> </path> </annotationProcessorPaths> </configuration> </plugin> </plugins> </build> Latest versions: https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin https://mvnrepository.com/artifact/org.projectlombok/lombok

Compilation error after upgrading to JDK 21 – “NoSuchFieldError: JCImport does not have member field JCTree qualid”

The culprit is Lombok. The minimal Lombok version compatible with JDK 21 is 1.18.30. This implies that the minimal Spring Boot version is 3.1.4, unless you want to meddle with the Spring Boot autoconfiguration and set the Lombok version in your project differently from the Spring Boot BOM defined in spring-boot-dependencies. See: https://github.com/projectlombok/lombok/issues/3393

MapStruct + Lombok together not compiling: unknown property in result type

The reason why it does not work is because Maven only uses the MapStruct processor and not the Lombok one. The annotationProcessorPaths tells maven which processors it should use. The delombok does nothing as you are ending up with 2 files per class and I think that the maven compiler does not see them. You … Read more

Spring Boot logging with Lombok

I would use @Slf4j. Tested the following and it works as expected. @SpringBootApplication @Slf4j public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); log.info(“testing logging with lombok”); } } Then you can change the logging level as described here. logging.level.com.example.DemoApplication=WARN Note: Below clarifies that SLF4J is correctly handled but point is made … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)