Home / 1.0.0.Final
Name Modified Size Downloads / Week Status
Parent folder
readme.md 2015-11-25 5.3 kB 0
mapstruct-1.0.0.Final-dist.zip 2015-11-25 4.3 MB 11 weekly downloads
mapstruct-1.0.0.Final-dist.tar.gz 2015-11-25 2.1 MB 0
Totals: 3 Items   6.4 MB 1

MapStruct - Java bean mappings, the easy way!

Version: 1.0.0.Final, November 25th 2015

What is MapStruct?

MapStruct is a Java annotation processor for the generation of type-safe bean mapping classes.

All you have to do is to define a mapper interface which declares any required mapping methods. During compilation, MapStruct will generate an implementation of this interface. This implementation uses plain Java method invocations for mapping between source and target objects, i.e. no reflection or similar.

Compared to writing mapping code from hand, MapStruct saves time by generating code which is tedious and error-prone to write. Following a convention over configuration approach, MapStruct uses sensible defaults but steps out of your way when it comes to configuring or implementing special behavior.

Compared to dynamic mapping frameworks, MapStruct offers the following advantages:

  • Fast execution by using plain method invocations instead of reflection
  • Compile-time type safety: Only objects and attributes mapping to each other can be mapped, no accidental mapping of an order entity into a customer DTO etc.
  • Self-contained code, no runtime dependencies
  • Clear error-reports at build time, if entities or attributes can't be mapped
  • Mapping code is easy to debug (or edited by hand e.g. in case of a bug in the generator)

MapStruct works in command line builds (plain javac, via Maven, Gradle, Ant etc.) and IDEs. For Eclipse, there is a dedicated plug-in under development (see https://github.com/mapstruct/mapstruct-eclipse) which goes beyond what's possible with an annotation processor, providing content assist for annotation attributes, quick fixes and more.

Documentation and getting help

To learn more about MapStruct in two minutes, refer to the project homepage. The reference documentation covers all provided functionality in detail. If you need help, come and join the mapstruct-users group.


MapStruct requires Java 1.6 or later.

Using MapStruct

MapStruct is a Java annotation processor based on JSR 269 and as such can be used within command line builds (javac, Ant, Maven etc.) as well as from within your IDE.

For Maven based projects add the following to your POM file in order to use MapStruct (the dependencies can be obtained from Maven Central):


... <properties> <org.mapstruct.version>1.0.0.Final</org.mapstruct.version> </properties> ... <dependencies> <dependency> <groupId>org.mapstruct</groupId> <artifactId>mapstruct</artifactId> <version>${org.mapstruct.version}</version> </dependency> <!-- Use this with Java 8 and beyond --> <dependency> <groupId>org.mapstruct</groupId> <artifactId>mapstruct-jdk8</artifactId> <version>${org.mapstruct.version}</version> </dependency> </dependencies> ... <build> <plugins> <plugin> <groupId>org.bsc.maven</groupId> <artifactId>maven-processor-plugin</artifactId> <version>2.2.4</version> <configuration> <defaultOutputDirectory> ${project.build.directory}/generated-sources </defaultOutputDirectory> <processors> <processor>org.mapstruct.ap.MappingProcessor</processor> </processors> </configuration> <executions> <execution> <id>process</id> <phase>generate-sources</phase> <goals> <goal>process</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>org.mapstruct</groupId> <artifactId>mapstruct-processor</artifactId> <version>${org.mapstruct.version}</version> </dependency> </dependencies> </plugin> </plugins> </build> ... ```

Alternatively, a distribution bundle is available from SourceForge.


MapStruct is licensed under the Apache License, Version 2.0 (the "License"); you may not use it except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

Building from Source

MapStruct uses Maven for its build. To build the complete project run

mvn clean install

from the root of the project directory. To skip the distribution module, run

mvn clean install -DskipDistribution=true


<div style="float: right"> <a href="https://mapstruct.ci.cloudbees.com/"><img src="http://www.cloudbees.com/sites/default/files/Button-Built-on-CB-1.png"/></a> </div>

Source: readme.md, updated 2015-11-25

Thanks for helping keep SourceForge clean.

Screenshot instructions:
Red Hat Linux   Ubuntu

Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Briefly describe the problem (required):

Upload screenshot of ad (required):
Select a file, or drag & drop file here.

Please provide the ad click URL, if possible:

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks