mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#769 Updating set-up description to make use of Maven compiler plug-in
This commit is contained in:
parent
d59873d923
commit
d4eb3fe290
@ -63,39 +63,38 @@ For Maven based projects add the following to your POM file in order to use MapS
|
|||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.bsc.maven</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-processor-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>2.2.4</version>
|
<version>3.5.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<defaultOutputDirectory>
|
<source>1.8</source>
|
||||||
${project.build.directory}/generated-sources
|
<target>1.8</target>
|
||||||
</defaultOutputDirectory>
|
<annotationProcessorPaths>
|
||||||
<processors>
|
<path>
|
||||||
<processor>org.mapstruct.ap.MappingProcessor</processor>
|
<groupId>org.mapstruct</groupId>
|
||||||
</processors>
|
<artifactId>mapstruct-processor</artifactId>
|
||||||
|
<version>${org.mapstruct.version}</version>
|
||||||
|
</path>
|
||||||
|
</annotationProcessorPaths>
|
||||||
</configuration>
|
</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>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
...
|
||||||
----
|
----
|
||||||
====
|
====
|
||||||
|
|
||||||
|
[TIP]
|
||||||
|
====
|
||||||
|
If you are working with the Eclipse IDE, make sure to have a current version of the http://www.eclipse.org/m2e/[M2E plug-in].
|
||||||
|
When importing a Maven project configured as shown above, it will set up the MapStruct annotation processor so it runs right in the IDE, whenever you save a mapper type.
|
||||||
|
Neat, isn't it?
|
||||||
|
|
||||||
|
To double check that everything is working as expected, go to your project's properties and select "Java Compiler" -> "Annotation Processing" -> "Factory Path".
|
||||||
|
The MapStruct processor JAR should be listed and enabled there.
|
||||||
|
Any processor options configured via the compiler plug-in (see below) should be listed under "Java Compiler" -> "Annotation Processing".
|
||||||
|
====
|
||||||
|
|
||||||
[[configuration-options]]
|
[[configuration-options]]
|
||||||
=== Configuration options
|
=== Configuration options
|
||||||
|
|
||||||
@ -110,20 +109,29 @@ When invoking javac directly, these options are passed to the compiler in the fo
|
|||||||
----
|
----
|
||||||
...
|
...
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.bsc.maven</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-processor-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.5.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<processors>
|
<source>1.8</source>
|
||||||
<processor>org.mapstruct.ap.MappingProcessor</processor>
|
<target>1.8</target>
|
||||||
</processors>
|
<annotationProcessorPaths>
|
||||||
<options>
|
<path>
|
||||||
<mapstruct.suppressGeneratorTimestamp>true</mapstruct.suppressGeneratorTimestamp>
|
<groupId>org.mapstruct</groupId>
|
||||||
<mapstruct.defaultComponentModel>cdi</mapstruct.defaultComponentModel>
|
<artifactId>mapstruct-processor</artifactId>
|
||||||
</options>
|
<version>${org.mapstruct.version}</version>
|
||||||
...
|
</path>
|
||||||
|
</annotationProcessorPaths>
|
||||||
|
<compilerArgs>
|
||||||
|
<compilerArg>
|
||||||
|
-Amapstruct.suppressGeneratorTimestamp=true
|
||||||
|
</compilerArg>
|
||||||
|
<compilerArg>
|
||||||
|
-Amapstruct.suppressGeneratorVersionInfoComment=true
|
||||||
|
</compilerArg>
|
||||||
|
</compilerArgs>
|
||||||
</configuration>
|
</configuration>
|
||||||
...
|
</plugin>
|
||||||
<plugin>
|
|
||||||
...
|
...
|
||||||
----
|
----
|
||||||
====
|
====
|
||||||
|
Loading…
x
Reference in New Issue
Block a user