From d1911049823bd4ba5f695904500ab4cf2b16207c Mon Sep 17 00:00:00 2001 From: eis Date: Mon, 15 May 2017 18:58:40 +0300 Subject: [PATCH] [MNG-5756] Java home output in mvn -v is misleading Renamed previous printing of JRE to "JRE used" and provided separate mechanism to actually tell value of JAVA_HOME --- .../main/java/org/apache/maven/cli/CLIReportingUtils.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java index 52f2053833fa..d7e66e0e6a64 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java @@ -68,7 +68,10 @@ public static String showVersion() version.append( "Java version: " ).append( System.getProperty( "java.version", "" ) ).append( ", vendor: " ).append( System.getProperty( "java.vendor", "" ) ).append( ls ); - version.append( "Java home: " ).append( System.getProperty( "java.home", "" ) ).append( ls ); + String javaHome = System.getenv( "JAVA_HOME" ); + javaHome = ( javaHome == null ? "" : javaHome ); + version.append( "Java home: " ).append( javaHome ).append( ls ); + version.append( "JRE used: " ).append( System.getProperty( "java.home", "" ) ).append( ls ); version.append( "Default locale: " ).append( Locale.getDefault() ).append( ", platform encoding: " ).append( System.getProperty( "file.encoding", "" ) ).append( ls ); version.append( "OS name: \"" ).append( Os.OS_NAME ).append( "\", version: \"" ).append( Os.OS_VERSION ).append(