Building MapStruct within an IDE

IntelliJ IDEA

After you’ve cloned you can import it by selecting “File -> Import Module …” and then selecting the top level aggregator pom.xml file located in the root folder. IDEA then will load MapStruct, resolve all dependencies and compile the source.

You might face an error on IDEAs Message tab saying

If so, open the preferences window, navigate to Compiler -> Annotation processor and untick checkbox “Enable annotation processing” at “Annotation profile for mapstruct-integrationtest”.

You should now be able to rebuild MapStruct.

For running MapStruct unit tests from IDEA open the “Run/Debug Configurations” preferences, expand “Default” on the left side and navigate to “JUnit”. There choose $MODULE_DIR$ as the working directory and you should now be able to run JUnit tests from IDEA.