You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2019/12/20 14:30:36 UTC

[GitHub] [maven-compiler-plugin] manouti commented on a change in pull request #29: (doc) Add example on using --release javac option

manouti commented on a change in pull request #29: (doc) Add example on using --release javac option
URL: https://github.com/apache/maven-compiler-plugin/pull/29#discussion_r360396042
 
 

 ##########
 File path: src/site/apt/examples/set-compiler-release.apt.vm
 ##########
 @@ -0,0 +1,82 @@
+ ------
+ Setting the --release of the Java Compiler
+ ------
+ Mahmoud Anouti
+ ------
+ 2019-12-20
+ ------
+
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements.  See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership.  The ASF licenses this file
+~~ to you under the Apache License, Version 2.0 (the
+~~ "License"); you may not use this file except in compliance
+~~ with the License.  You may obtain a copy of the License at
+~~
+~~   http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing,
+~~ software distributed under the License is distributed on an
+~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+~~ KIND, either express or implied.  See the License for the
+~~ specific language governing permissions and limitations
+~~ under the License.
+
+~~ NOTE: For help with the syntax of this file, see:
+~~ http://maven.apache.org/doxia/references/apt-format.html
+
+Setting the <<<--release>>> of the Java Compiler
+
+  Starting JDK 9, the <<<javac>>> executable can accept the <<<--release>>>
+  option to specify against which Java SE release you want to build the project.
+  For example, you have JDK 11 installed and used by Maven, but you want to
+  build the project against Java 8.
+  The <<<--release>>> option ensures that the code is compiled following the
+  rules of the programming language of the specified release, and that generated
+  classes target the release as well as the public API of that release. This
+  means that, unlike the
+  {{{../examples/set-compiler-source-and-target.html}<<<-source>>> and <<<-target>>> options}},
+  the compiler will detect and generate an error when using APIs that don't exist
+  in previous releases of Java SE.
+
+  Since version 3.6 of the Compiler Plugin, this option can be provided either
+  via a property:
+
++-----
+<project>
+  [...]
+  <properties>
+    <maven.compiler.release>8</maven.compiler.release>
+  </properties>
+  [...]
+</project>
++-----
+
+  or by configuring the plugin directly:
+
++-----
+<project>
+  [...]
+  <build>
+    [...]
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.8.0</version>
 
 Review comment:
   Ah nice! Updated.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services