javaeclipsemavenannotationsannotation-processing

Annotations not generated in Eclipse IDE


I'm struglling with annotations in Eclipse since no annotation generates code. I tried several solutions:

  1. Checking the "Enable annotation processing" under Annotation Processing in Java Compiler in the project properties
  2. Creating a new Maven project (Java 17 with 2 dependencies: Lombok and log4j only)
  3. Followed the directions in this tutorial Eclipse getting started with AP
  4. several mvn clean intalls, eclipse clean project, closing and reopening the IDE ...

here is my pom

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.annot</groupId>
<artifactId>annotations</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>annotations</name>
<properties>
    <java.version>17</java.version>
    <maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencies>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.18.24</version>
        <scope>provided</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/log4j/log4j -->
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>

</dependencies>

<build>
<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>  
        <configuration>
            <annotationProcessorPaths>
                <path>
                    <groupId>org.projectlombok</groupId>
                    <artifactId>lombok</artifactId>
                    <version>1.18.24</version> 
                </path>
            </annotationProcessorPaths>
        </configuration>
    </plugin>
</plugins>

here is an example class containing two lombok annotation and the outline (showing that no method was generated) enter image description here The annotation Processing window in Java Compiler in the project properties enter image description here

neither the constructor is recognized nor the @log4j annotation generates the appropriate logger

The factory path enter image description here

I'm used to use annotations in java projects with eclipse but i never encountered this problem. Any idea to solve this? thanks


Solution

  • Do this steps :

    java -jar <Your_jar_name.jar>

    .

    https://projectlombok.org/setup/eclipse