#2366 Update documentation in regards to Java Module System

This commit is contained in:
Jude Niroshan 2021-03-07 14:11:45 +01:00 committed by GitHub
parent d9fdd86b94
commit 228660c74f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.