You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2020/05/02 10:38:16 UTC
[maven-compiler-plugin] branch master updated: reorder: simpler 6
to 8 compatibility first, older 5- after
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-compiler-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new ced9307 reorder: simpler 6 to 8 compatibility first, older 5- after
ced9307 is described below
commit ced9307e260abe9ec873bdd4dabd0229d8301009
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Sat May 2 12:38:11 2020 +0200
reorder: simpler 6 to 8 compatibility first, older 5- after
---
src/site/apt/examples/module-info.apt.vm | 53 +++++++++++++++++++-------------
1 file changed, 31 insertions(+), 22 deletions(-)
diff --git a/src/site/apt/examples/module-info.apt.vm b/src/site/apt/examples/module-info.apt.vm
index a65dcbc..48669a4 100644
--- a/src/site/apt/examples/module-info.apt.vm
+++ b/src/site/apt/examples/module-info.apt.vm
@@ -45,11 +45,17 @@ Older projects with module-info
[]
- JDK 9 only supports compilations for
- Java 6 and above, so projects wanting to be compatible with Java 5 or below need to use two different JDKs. With
- {{{/guides/mini/guide-using-toolchains.html}toolchains}} it is quite easy to achieve this. Be aware that you will
- need at least Maven 3.3.1 to specify a custom jdkToolchain in your plugin configuration. You could add a jdkToolchain
- to do base-compile execution-block as well referring to JDK 5.
+ Notice that, in addition, JDK 9 only supports compilations for Java 6 and above, so projects wanting to be compatible with Java 5 or below need
+ to use two different JDKs for the 2 executions. With {{{/guides/mini/guide-using-toolchains.html}toolchains}} configuration, it is
+ quite easy to achieve this, even if a little bit more complex.
+
+* Java 6 to 8 Compatibility
+
+ In case you want the project to be Java 6, 7 or 8 compatible, you can simply use JDK 9 for both execution blocks.
+
+ The easiest way is to use Java 9 as the runtime for Maven, by setting <<<JAVA_HOME=/path/to/jdk-9>>> before running <<<mvn>>>.
+ But if you want to use an older Java runtime for Maven, you can use the maven-toolchain-plugin to specify the shared JDK (supported since Maven 2.0.9)
+ or a custom jdkToolchain (supported since Maven 3.3.1) and refer to the JDK 9 installation on your system.
+-------
<project>
@@ -67,10 +73,6 @@ Older projects with module-info
<configuration>
<release>9</release>
<!-- no excludes: compile everything to ensure module-info contains right entries -->
- <!-- required when JAVA_HOME is JDK 8 or below -->
- <jdkToolchain>
- <version>9</version>
- </jdkToolchain>
</configuration>
</execution>
<execution>
@@ -78,8 +80,8 @@ Older projects with module-info
<goals>
<goal>compile</goal>
</goals>
- <!-- recompile everything for target VM except the module-info.java -->
<configuration>
+ <!-- recompile everything for target VM except the module-info.java -->
<excludes>
<exclude>module-info.java</exclude>
</excludes>
@@ -88,11 +90,10 @@ Older projects with module-info
</executions>
<!-- defaults for compile and testCompile -->
<configuration>
- <source>1.5</source>
- <target>1.5</target>
- <!-- jdkToolchain required when JAVA_HOME is JDK 9 or above -->
+ <release>6</release><!-- or 7 or 8 depending on compatibility expectations -->
+ <!-- Only required when Maven runtime JAVA_HOME isn't at least Java 9 and when haven't configured the maven-toolchains-plugin -->
<jdkToolchain>
- <version>[1.5,9)</version>
+ <version>9</version>
</jdkToolchain>
</configuration>
</plugin>
@@ -103,10 +104,13 @@ Older projects with module-info
</project>
+-------
- In case you want the project to be Java 6 compatible, the easiest to do this is to use Java 9 for both execution
- blocks. You can use the maven-toolchain-plugin to specify the shared JDK (supported since Maven 2.0.9) or a custom
- jdkToolchain (supported since Maven 3.3.1) and refer to the JDK 9 installation on your system. Or simply use Java 9
- as the runtime for Maven by setting <<<JAVA_HOME=/path/to/jdk-9>>>.
+* Java 5 or below Compatibility
+
+ Given Maven 3 requires newer Java release at runtime, you'll absolutely need to use Toolchains to use a JDK different from
+ Maven runtime.
+
+ Be aware that you will need at least Maven 3.3.1 to specify a custom jdkToolchain in your plugin configuration.
+ You could add a jdkToolchain to do base-compile execution-block as well referring to JDK 5.
+-------
<project>
@@ -124,6 +128,10 @@ Older projects with module-info
<configuration>
<release>9</release>
<!-- no excludes: compile everything to ensure module-info contains right entries -->
+ <!-- toolchain required when JAVA_HOME is JDK 8 or below -->
+ <jdkToolchain>
+ <version>9</version>
+ </jdkToolchain>
</configuration>
</execution>
<execution>
@@ -131,8 +139,8 @@ Older projects with module-info
<goals>
<goal>compile</goal>
</goals>
- <!-- recompile everything for target VM except the module-info.java -->
<configuration>
+ <!-- recompile everything for target VM except the module-info.java -->
<excludes>
<exclude>module-info.java</exclude>
</excludes>
@@ -141,10 +149,11 @@ Older projects with module-info
</executions>
<!-- defaults for compile and testCompile -->
<configuration>
- <release>6</release><!-- or 7 or 8 depending on compatibility expectations -->
- <!-- Only required when JAVA_HOME isn't at least Java 9 and when haven't configured the maven-toolchains-plugin -->
+ <source>1.5</source>
+ <target>1.5</target>
+ <!-- jdkToolchain required when JAVA_HOME is JDK 9 or above -->
<jdkToolchain>
- <version>9</version>
+ <version>[1.5,9)</version>
</jdkToolchain>
</configuration>
</plugin>