Loading...

Delombok Java Beans

If you are using Lombok you can let lombok generate via the Maven Plugin the source code.

There are several approaches. Per se, Lombok expects a dedicated source folder src/main/lombok. If you have your Java Beans not in that folder, you can configure in the build section of the lombok maven plugin the sourceDirectory.

 <!-- delombok for source analysis-->
<build>
<plugins>
    <plugin>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok-maven-plugin</artifactId>
        <version>1.16.18.0</version>
        <executions>
            <execution>
                <phase>generate-sources</phase>
                <goals><goal>delombok</goal></goals>
            <configuration>
                <addOutputDirectory>false</addOutputDirectory>
                <sourceDirectory>src/main/java/model</sourceDirectory>
            </configuration>
        </execution>
    </executions>
    </plugin>
</plugins>
</build>

If you are using the default, you need to add this source folder to the maven compiler plugin.

<build>    
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.6.1</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
                <includes><include>src/main/lombok</include></includes>
            </configuration>
        </plugin>
    </plugins>
</build>