Adding lombok dependency and @Slf4j does not let use logger

You also need to add slf4j itself as a dependency to your project by including it in your pom file. All lombok features in the lombok.extern package share this property: They help you use a library that is NOT already available out of the box as part of java itself, and for all of them, lombok does not inherently include any of these dependencies.

Should be as simple as adding the following block to your pom.xml:

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.26</version>
</dependency>

I tried adding slf4j-api as a dependency as rzwitserloot suggested above, but that did not work for me. Adding it as a plugin in my build.gradle file did, though:

plugins {
    ...
    id 'io.freefair.lombok' version '4.1.6'
    ...
}

Tags:

Java

Lombok