IDE Support

One of the big advantages of MapStruct is the early feedback on problems with the mapping configuration. To fully leverage this in your IDE, make sure the annotation processor runs with each compilation.


Maven Integration

If you are working with a Maven project, then make sure you have the latest version of the m2e-apt plugin installed, which picks up and applies the annotation processor settings automatically.

For best results, add the following to the pom.xml:

  <!-- automatically run annotation processors within the incremental compilation -->

Gradle Integration

If you are working with a gradle project, then add the folowing plugin to the gradle project configuration in which you use the mapstruct mappers:

plugins {
    // Allow configuration calls for setting up the eclipse annotation processing configuration.
    id 'com.diffplug.eclipse.apt' version '3.37.2'
You can then generate the required eclipse project information by calling gradle eclipseJdtApt eclipseFactorypath eclipseJdt After generating the eclipse project information you need to synchronize your eclipse project to recognize the changes, you do this by refreshing the gradle project. In eclipse this is found in the context menu (usually right clicking on the project) of the project and then looking under Gradle for Refresh Gradle Project. Next check the project properties and make certain that the annotation processing is enabled.

Eclipse enabling annotation processing for gradle.

Editing Support

For Eclipse, we are also working on a Plugin that adds Code Completion (e.g. for property names) and Quick Fixes for common use cases:

Completion for Properties and Enum Constants

Code completion for properties and enum constants

Quick Fix to Ignore an Unmapped Property

Quick Fix to ignore an unmapped property


Drag the following icon into your running Eclipse workspace: Drag to your running Eclipse workspace..

Alternatively, you can obtain the MapStruct Eclipse Plugin from the Eclipse Marketplace. For more information and for installing the latest Snapshot version, visit the plugins GitHub project.

IntelliJ IDEA

Depending on how you configured the annotation processor in your Maven or Gradle project, IntelliJ may or may not pick it up automatically. You might need to make sure of it yourself in the project configuration.

Maven Integration

For example, if you use the way of Maven configuration that is proposed in our documentation using annotationProcessorPaths in the maven-compiler-plugin, then you need to configure IntelliJ manually until the feature request IDEA-150621 is implemented. An alternative is to add the mapstruct-processor as a project dependency with <optional>true</optional> in your pom.xml, which should then be picked up automatically again.

Editing Support

There is an IntelliJ plugin for MapStruct support, that you can find in the Jetbrains plugins repository here. The plugin is open source and you can report bugs and feature requests here on GitHub.

Completion for Properties and Enum Constants

Code completion for source

Go To Declaration from annotation

Go To Declaration

Find Usages

Find usages from Source methods


Maven Integration

If you use a Maven project, then there’s nothing more to do. NetBeans uses Maven to compile your sources, which includes the invocation of the annotation processor.

Editing Support

There are no plans of special editing support for MapStruct mappers in NetBeans that we know of, yet. But we’d love to see one!