I'm trying to create a static method in order to ease the builder usage and return the created builder to continue creating the object if it's needed:
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Foo {
private String submit;
private String modify;
public static Foo.FooBuilder ofSubmit(String submit) {
return Foo.builder()
.submit(submit);
}
}
In IntelliJ works properly but when I compile with maven I get next error:
diagnostic: /src/main/java/com/Foo.java:33: error: cannot find symbol
public static Foo.FooBuilder ofSubmit(String pan,
^
symbol: class FooBuilder
location: class com.Foo
I'm using Lombok 1.18.20
Any idea?
//EDIT
Include the maven configuration:
maven-compiler-plugin whit mapstruct compatibility configuration:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${org.projectlombok.version}</version>
</path>
<!-- This is needed when using Lombok 1.18.16 and above -->
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-mapstruct-binding</artifactId>
<version>0.2.0</version>
</path>
<!-- Mapstruct should follow the lombok path(s) -->
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>