I'm getting this compilation error:
ReferenceGroup does not have an accessible constructor.
Here my mapper method:
@Mapping(source = "groups", target = "nestedGroups")
@Mapping(source = "references", target = "nestedReferences")
net.gencat.transversal.espaidoc.domain.model.reference.ReferenceGroup toDomainModel(
ReferenceGroup referenceGroup);
My related class is:
@Getter
public class ReferenceGroup {
private final List<NestedGroup> nestedGroups;
private final List<NestedReference> nestedReferences;
@Builder
private ReferenceGroup(List<NestedGroup> nestedGroups, List<NestedReference> nestedReferences) {
As you can see, ReferenceGroup class has no a public constructor. Instead of that, it has a lombok Builder class.
First question here, is why mapstruct is not detecting my Builder class. I've tested ReferenceGroupBuilder class visibility implementing a dump method inside the same mapper:
default void sdf() {
net.gencat.transversal.espaidoc.domain.model.reference.ReferenceGroup sdf = net.gencat.transversal.espaidoc.domain.model.reference.ReferenceGroup
.builder().build();
}
I've to say that another builder class exists: ReferenceGroupPathBuilder. Has it nothing to do?
My maven settings are:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org-mapstruct.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-mapstruct-binding</artifactId>
<version>0.2.0</version>
</dependency>
</annotationProcessorPaths>
<compilerArgs>
</compilerArgs>
</configuration>