I'm willing to use MapStruct in some official project so I decided to give it some testing first; I'd need to make it work integrated with eclipse and followed all the instructions provided on MapStruct website but ... so far no luck. Did anyone succeeded on such integration? and if yes what can I be missing?
My test started with something bigger, but when I realized it was not working I decided to use a smaller example, so this is what I did:
... no way to persuade eclipse to auto-generate the mapper implementation, I even added the jdt_apt line to the pom.
Here is a snippet of the pom.xml - please refer to he mapstruct-clone project for the whole code.
<properties>
<org.mapstruct.version>1.3.0.Final</org.mapstruct.version>
<m2e.apt.activation>jdt_apt</m2e.apt.activation>
</properties>
Expected result would be:
Important edit: I'm also using the lombok javaagent
Can I use MapStruct together with Project Lombok? Yes, as of MapStruct 1.2. 0. Beta1 and Lombok 1.16.
IntelliJ IDEA xml file located in the root folder. IDEA then will load MapStruct, resolve all dependencies and compile the source. If so, open the preferences window, navigate to Compiler -> Annotation processor and untick checkbox “Enable annotation processing” at “Annotation profile for mapstruct-integrationtest”.
MapStruct is an open-source Java-based code generator which creates code for mapping implementations. It uses annotation-processing to generate mapper class implementations during compilation and greatly reduces the amount of boilerplate code which would regularly be written by hand.
MapStruct is all open source and your help is highly appreciated. MapStruct follows the Fork & Pull development approach.
I eventually found the solution to the issue ( =D )
The issue was indeed tied to an incompatibility between Lombok java agent and MapStruct. To get it to work just do what Pavel suggested in his last post and it will work:
[...] simply remove the SPI registration inside lombok.jar (by deleting META-INF/services/org.mapstruct.ap.spi.AstModifyingAnnotationProcessor) [...]
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