I am using mapstruct in Java and I need to get rid of warning: Warning: Unmapped target properties: "t3". I have the following structure:
class A {
String t1;
String t2;
}
class B {
String t1;
String t2;
String t3;
}
I am mapping with mapstruct from B to A class.
B toB(A a);
I would like to ignore just one field (t3), but @Mapping required target property, so I cannot use @Mapping(source = "t3", ignore = true). Is there any solution for that?
TRYING: I was trying to use @Mapping and use unmappedTargetPolicy = ReportingPolicy.IGNORE, but I want to ignore only specific field.
EXPECT: I would like to ignore just one field (t3), but @Mapping required target property, so I cannot use @Mapping(source = "t3", ignore = true). Is there any solution for that?
You can use
@Mapping(target = "t3", ignore = true)even if it belongs to the "source" not the "target" of the mapping.