Permalink
Find file
5723ba6 Jan 3, 2017
96 lines (80 sloc) 2.97 KB

+++ date = "2016-12-31T13:23:04+01:00" draft = false title = "Installation" weight = 100 teaser = "How to download and set it up with different build tools" aliases = [ "/download/" ] [menu] [menu.main] parent = "Documentation" +++

Distribution Bundle

You can obtain a distribution bundle containing the MapStruct binaries, source code and API documentation from SourceForge.

Apache Maven

If you're using Maven to build your project add the following to your pom.xml to use MapStruct:

{{< prettify xml >}}... {{% stableversion %}} ... org.mapstruct mapstruct ${org.mapstruct.version} ... org.apache.maven.plugins maven-compiler-plugin 3.5.1 1.6 1.6 org.mapstruct mapstruct-processor ${org.mapstruct.version} {{< /prettify >}}

Gradle

With Gradle, you add something along the following lines to your build.gradle:

{{< prettify groovy >}}plugins { ... id 'net.ltgt.apt' version '0.8' } dependencies { ... compile 'org.mapstruct:mapstruct:{{% stableversion %}}'

// OR use this with Java 8 and beyond
compile 'org.mapstruct:mapstruct-jdk8:{{% stableversion %}}'

apt 'org.mapstruct:mapstruct-processor:{{% stableversion %}}'

} {{< /prettify >}}

You can find a complete example in the mapstruct-examples project on GitHub.

Apache Ant

Add the javac task configured as follows to your build.xml file in order to enable MapStruct in your Ant-based project. Adjust the paths as required for your project layout.

{{< prettify xml >}} ... ... {{< /prettify >}}

You can find a complete example in the mapstruct-examples project on GitHub.