aherbert commented on code in PR #187:
URL: 
https://github.com/apache/maven-compiler-plugin/pull/187#discussion_r1181274592


##########
src/site/apt/examples/set-compiler-release.apt.vm:
##########
@@ -80,3 +80,30 @@ Setting the <<<--release>>> of the Java Compiler
   since Java 9. As such, the release number does not start with 1.x anymore. 
Also note that the
   supported <<<release>>> targets include the release of the currently used 
JDK plus a limited number
   of previous releases.
+
+* Usage on JDK 8
+
+  The <<<--release>>> option is used to target an older Java release than the 
JDK used during the
+  build process. This flag is not supported using JDK 8. To enable a project 
that targets Java 8
+  to be built using JDK 8 or later requires the conditional usage of the 
<<<--release>>> option.

Review Comment:
   The table `--release` column should really read `set 
<maven.compiler.release>8</maven.compiler.release>` but that was too long. 
Forgive my shorthand with no explanation.
   
   When you set `<maven.compiler.release>8</maven.compiler.release>` then the 
maven plugin will use the `--release` flag. This is not ignored by JDK 8; as 
you state it does not exhibit this flag as an option. Using it raises an error. 
So you cannot set it when building with JDK 8. You should only set it for JDK 
9+.
   
   If this is not clear from my documentation then we can revise it. It is 
trying to state:
   
   1. Do not use this flag when building with JDK 8
   2. Use it when building with a later JDK (i.e. 9+) and targeting Java 8
   
   I think a perfectly valid example is a project with a toolchain that uses 
JDK 8 only (i.e. it can be built with JDK 8). This can still be compiled with 
JDK 11. But that may end up targeting the wrong Java API if some 
methods/classes have had updates. So your project then should _conditionally_ 
set the `<maven.compiler.release>` property. If you always set it then you have 
problems on JDK 8.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to