Hi I am trying to map my source to target but i am getting this error.
Here is My Pom.xml
<dependency>
    <groupId>org.mapstruct</groupId>
    <artifactId>mapstruct</artifactId>
    <version>1.5.5.Final</version>
</dependency>
<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <version>1.18.26</version>
</dependency>
<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok-mapstruct-binding</artifactId>
    <version>0.2.0</version>
</dependency>
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <annotationProcessorPaths>
            <path>
                <groupId>org.mapstruct</groupId>
                <artifactId>mapstruct-processor</artifactId>
                <version>1.5.5.Final</version>
            </path>
            <path>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>1.18.26</version>
            </path>
            <path>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok-mapstruct-binding</artifactId>
                <version>0.2.0</version>
            </path>
        </annotationProcessorPaths>
    </configuration>
</plugin>
My Mapper:
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
@Mapper(componentModel = "spring")
public interface CustomMapper {
    @Mapping(source = "rDAccount", target = "xfaceRDAccount")
    TargetClass mapToTarget(SourceClass sourceClass);
}
My SourceClass
import lombok.Data;
@Data
public class SourceClass {
    private String rDAccount;
}
My TargetClass
import lombok.Data;
@Data
public class TargetClass {
    private String xfaceRDAccount;
}
After running mvn clean install Error I am getting: No property named "rDAccount" exists in source parameter(s). Did you mean "RDAccount"?
In the mapper calls instead of @Mapping(source = "rDAccount", target = "xfaceRDAccount") try using @Mapping(source = "RDAccount", target = "xfaceRDAccount")
The getters and setters generated by lombok for rDAccount seems to getRDAccount and setRDAccount.

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With