You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/04/23 14:09:38 UTC

[commons-parent] branch master updated: Workaround MCOMPILER-534

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-parent.git


The following commit(s) were added to refs/heads/master by this push:
     new 7d6d524  Workaround MCOMPILER-534
7d6d524 is described below

commit 7d6d524948e62eab00e3edb3709fcef3f03d5bbe
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Apr 23 10:09:07 2023 -0400

    Workaround MCOMPILER-534
    
    MCOMPILER-534: Broken command line generated on Java 8 when
    maven.compiler.release is set
    
    Simpler configuration
---
 pom.xml | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/pom.xml b/pom.xml
index 0c07a91..7ca6d40 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1925,19 +1925,18 @@
       <activation>
         <jdk>[9</jdk>
       </activation>
-      <build>
-    	<pluginManagement>
-   	      <plugins>
-            <plugin>
-              <groupId>org.apache.maven.plugins</groupId>
-              <artifactId>maven-compiler-plugin</artifactId>
-              <configuration>
-                <release>${commons.compiler.release}</release>
-              </configuration>
-            </plugin>
-          </plugins>
-        </pluginManagement>
-      </build>
+      <properties>
+        <!--
+          The "release" compiler property (available in JDK 9+) must be set in order to generate
+          binary-compatible artifacts for the target JVM. This flag sets the version of the platform
+          APIs to compile against, which is necessary when building with a later JDK but targeting
+          an earlier one. For example, a covariant return type was added to java.nio.ByteBuffer.rewind()
+          in Java 9. If the release property is not set when compiling with JDK 9 for Java 8, then the
+          Java 9 method will be referenced in the bytecode, causing a runtime error when running on 8.
+          See also https://issues.apache.org/jira/browse/MCOMPILER-534
+       -->
+        <maven.compiler.release>${commons.compiler.release}</maven.compiler.release>
+      </properties>
     </profile>
 
     <!-- allow simple creation of the site without any optional reports -->