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 2017/12/20 09:16:37 UTC

[maven-javadoc-plugin] 06/13: unittest should prefer JAVA_HOME when executing from cmdline When running with Java9+ no need to switch from jre to jdk directory (jep220)

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

hboutemy pushed a commit to branch master2
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git

commit 7ab4eb5a9ed9bb152bb88d1e191388a4a5125708
Author: Robert Scholte <rf...@apache.org>
AuthorDate: Sat Dec 2 13:36:33 2017 +0000

    unittest should prefer JAVA_HOME when executing from cmdline
    When running with Java9+ no need to switch from jre to jdk directory (jep220)
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1816950 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/maven/plugins/javadoc/JavadocUtil.java  | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java b/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
index 90c5e84..4dc7631 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
@@ -1277,14 +1277,22 @@ public class JavadocUtil
      */
     private static File getJavaHome( Log log )
     {
-        File javaHome;
-        if ( SystemUtils.IS_OS_MAC_OSX )
-        {
-            javaHome = SystemUtils.getJavaHome();
-        }
-        else
+        File javaHome = null;
+
+        // if maven.home is set, we can assume JAVA_HOME must be used for testing
+        
+        if ( System.getProperty( "maven.home" ) == null )
         {
-            javaHome = new File( SystemUtils.getJavaHome(), ".." );
+            // JEP220 (Java9) restructured the JRE/JDK runtime image
+            if ( ( SystemUtils.IS_OS_MAC_OSX
+                || JavadocVersion.parse( SystemUtils.JAVA_VERSION ).compareTo( JavadocVersion.parse( "9" ) ) >= 0 ) )
+            {
+                javaHome = SystemUtils.getJavaHome();
+            }
+            else
+            {
+                javaHome = new File( SystemUtils.getJavaHome(), ".." );
+            }            
         }
 
         if ( javaHome == null || !javaHome.exists() )

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.