Skip to content

Commit

Permalink
mapstruct#2366 Update documentation in regards to Java Module System
Browse files Browse the repository at this point in the history
  • Loading branch information
JudeNiroshan authored Mar 7, 2021
1 parent d9fdd86 commit 228660c
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions documentation/src/main/asciidoc/chapter-2-set-up.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -248,20 +248,8 @@ If a policy is given for a specific mapper via `@Mapper#unmappedTargetPolicy()`,
|`WARN`
|===

=== Using MapStruct on Java 9
=== Using MapStruct with the Java Module System

MapStruct can be used with Java 9 (JPMS), support for it is experimental.
MapStruct can be used with Java 9 and higher versions.

A core theme of Java 9 is the modularization of the JDK. One effect of this is that a specific module needs to be enabled for a project in order to use the `javax.annotation.Generated` annotation. `@Generated` is added by MapStruct to generated mapper classes to tag them as generated code, stating the date of generation, the generator version etc.

To allow usage of the `@Generated` annotation the module _java.xml.ws.annotation_ must be enabled. When using Maven, this can be done like this:

export MAVEN_OPTS="--add-modules java.xml.ws.annotation"

If the `@Generated` annotation is not available, MapStruct will detect this situation and not add it to generated mappers.

[NOTE]
=====
In Java 9 `java.annotation.processing.Generated` was added (part of the `java.compiler` module),
if this annotation is available then it will be used.
=====
To allow usage of the `@Generated` annotation `java.annotation.processing.Generated` (part of the `java.compiler` module) can be enabled.

0 comments on commit 228660c

Please sign in to comment.