Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 3939a32

Browse files
committed
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
1 parent fc0ebca commit 3939a32

File tree

1 file changed

+15
-7
lines changed
  • maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc

1 file changed

+15
-7
lines changed

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

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,14 +1277,22 @@ private static String getMavenOpts( Log log )
12771277
*/
12781278
private static File getJavaHome( Log log )
12791279
{
1280-
File javaHome;
1281-
if ( SystemUtils.IS_OS_MAC_OSX )
1282-
{
1283-
javaHome = SystemUtils.getJavaHome();
1284-
}
1285-
else
1280+
File javaHome = null;
1281+
1282+
// if maven.home is set, we can assume JAVA_HOME must be used for testing
1283+
1284+
if ( System.getProperty( "maven.home" ) == null )
12861285
{
1287-
javaHome = new File( SystemUtils.getJavaHome(), ".." );
1286+
// JEP220 (Java9) restructured the JRE/JDK runtime image
1287+
if ( ( SystemUtils.IS_OS_MAC_OSX
1288+
|| JavadocVersion.parse( SystemUtils.JAVA_VERSION ).compareTo( JavadocVersion.parse( "9" ) ) >= 0 ) )
1289+
{
1290+
javaHome = SystemUtils.getJavaHome();
1291+
}
1292+
else
1293+
{
1294+
javaHome = new File( SystemUtils.getJavaHome(), ".." );
1295+
}
12881296
}
12891297

12901298
if ( javaHome == null || !javaHome.exists() )

0 commit comments

Comments
 (0)