Hi,
I assume the problems you see are related to your usage of Lombok for
generating getters/setters. The combination of Lombok + MapStruct is
known to cause issues, as it's not possible for MapStruct to detect
the accessors generated by Lombok in a reliable way.
The problem is that Lombok *alters* the AST, which is generally not
intended in the JSR 269 annotation processing environment and other
processors - that are playing by the rules - don't have a chance to
properly "see" these amendments to the AST.
The best work-around at this point is to have your DTOs/entities
(whatever you apply Lombok to) and the mapper interfaces (to which you
apply MapStruct to) in two separate modules of your build (see
https://github.com/mapstruct/mapstruct-examples/tree/master/mapstruct-lombok
for an example). That way MapStruct can see the generated
getters/setters.
For some more backgrounds of this issue also see
https://github.com/mapstruct/mapstruct/issues/510.
Hth,
--Gunnar
2016-02-02 7:50 GMT+01:00 ZW <
zw...@coupang.com>:
> Since My Entity and Dto are follows exact the same namings, so I didn't
> specify the @Mappsings() explicitly, however this works in a very flaky way.
>
>> public interface EntityAMapper {
>> ADto entityAToDto(EntityA e);
>>
>> }
>
>
> When I run gradle test, I got warnings saying "warning: Unmapped target
> properties ...", then I get an empty generation of the EntityAMapper
> Impl.java
>
> When I run with Intellij unit test, the first time it always success, if I
> try to rebuild the project, then all of them are failed, because it
> generates empty implementations,
> but if I change the class definition a little bit, i.e. from interface to
> abstract class, it starts working again, after rebuild it fails again,
> change back to interface it works again.
>
> I really don't want to specify all the mapping property in the Mappings()
> configuration, that's reason why I use this lib, but seems it's quite
> unstable.
>
> I also couldn't use the gradle annotation processor plugin in the given
> example, it conflicts with Lombok annotations.
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "mapstruct-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
mapstruct-use...@googlegroups.com.
> To post to this group, send email to
mapstru...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.