I am trying to build a Java 11 project with maven and lombok's @Slf4j Logger, but maven does not recognize the log
variables. IntelliJ does though and is able to build the project.
The error is
[ERROR]: cannot find symbol variable log
Project and Module SDK is both Java 11. Lombok Version is 1.18.2:
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
<scope>provided</scope>
</dependency>
My maven compiler setup:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
I already tried:
- turning Annotaion Processing off and on again
- reinstalling Lombok plugin
- clearing .m2/repository folder
- manually adding lombok.jar as Annotation Processor
- adding Lombok path to
maven-compiler-plugin
list of Annotation Processor
<annotationProcessorPaths>
configuration in your code and try. By some experience I wrote this comment to a similar configuration in my code<!--contradictory to maven, intelliJ fails with this-->
– Pleistocene