svn commit: r1816950 - /maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1816950 - /maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java

Robert Scholte-8
Author: rfscholte
Date: Sat Dec  2 13:36:33 2017
New Revision: 1816950

URL: http://svn.apache.org/viewvc?rev=1816950&view=rev
Log:
unittest should prefer JAVA_HOME when executing from cmdline
When running with Java9+ no need to switch from jre to jdk directory (jep220)

Modified:
    maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java?rev=1816950&r1=1816949&r2=1816950&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java Sat Dec  2 13:36:33 2017
@@ -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() )