You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2021/07/23 20:45:50 UTC

[maven] 01/01: [MNG-7010] Omit "NB: JAVA_HOME should point to a JDK not a JRE" except when that is the problem

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

michaelo pushed a commit to branch MNG-7010
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 5e03eca4dfa400edb3b7d6fd49a75319ffa56988
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Fri Jul 23 22:45:34 2021 +0200

    [MNG-7010] Omit "NB: JAVA_HOME should point to a JDK not a JRE" except when that is the problem
    
    This closes #512
---
 apache-maven/src/assembly/shared/init         | 7 ++++---
 apache-maven/src/assembly/shared/validate.cmd | 9 ++++++---
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/apache-maven/src/assembly/shared/init b/apache-maven/src/assembly/shared/init
index 3ccae85..6979cbf 100755
--- a/apache-maven/src/assembly/shared/init
+++ b/apache-maven/src/assembly/shared/init
@@ -50,14 +50,15 @@ if [ -z "$JAVACMD" ] ; then
 fi
 
 if [ ! -x "$JAVACMD" ] ; then
-  echo "The JAVA_HOME environment variable is not defined correctly" >&2
-  echo "This environment variable is needed to run this program" >&2
-  echo "NB: JAVA_HOME should point to a JDK not a JRE" >&2
+  echo "The JAVA_HOME environment variable is not defined correctly," >&2
+  echo "this environment variable is needed to run this program." >&2
   exit 1
 fi
 
 if [ -z "$JAVA_HOME" ] ; then
   echo "Warning: JAVA_HOME environment variable is not set." >&2
+elif [ ! -x "$JAVA_HOME/bin/javac" ] ; then
+  echo "Warning: JAVA_HOME should point to a JDK not a JRE." >&2
 fi
 
 # traverses directory structure from process work directory to filesystem root
diff --git a/apache-maven/src/assembly/shared/validate.cmd b/apache-maven/src/assembly/shared/validate.cmd
index e2a6e4e..c42e068 100644
--- a/apache-maven/src/assembly/shared/validate.cmd
+++ b/apache-maven/src/assembly/shared/validate.cmd
@@ -55,12 +55,15 @@ set "JAVACMD=%JAVA_HOME%\bin\java.exe"
 
 :checkJCmd
 if not exist "%JAVACMD%" (
-  echo The JAVA_HOME environment variable is not defined correctly >&2
-  echo This environment variable is needed to run this program >&2
-  echo NB: JAVA_HOME should point to a JDK not a JRE >&2
+  echo The JAVA_HOME environment variable is not defined correctly, >&2
+  echo this environment variable is needed to run this program. >&2
   goto error
 )
 
 if "%JAVA_HOME%"=="" (
   echo Warning: JAVA_HOME environment variable is not set. >&2
+) else (
+  if not exist "%JAVA_HOME%\bin\javac.exe" (
+    echo Warning: JAVA_HOME should point to a JDK not a JRE. >&2
+  )
 )