Blob Blame History Raw
From ea6096c4e36e4af01ba8a43aa9934aa013bf8841 Mon Sep 17 00:00:00 2001
From: Michael Simacek <msimacek@redhat.com>
Date: Wed, 1 Feb 2017 14:54:26 +0100
Subject: [PATCH 1/5] Adapt mvn script

---
 apache-maven/src/bin/mvn | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/apache-maven/src/bin/mvn b/apache-maven/src/bin/mvn
index a554c66..b9c5d32 100755
--- a/apache-maven/src/bin/mvn
+++ b/apache-maven/src/bin/mvn
@@ -22,7 +22,7 @@
 #
 # Environment Variable Prerequisites
 #
-#   JAVA_HOME       Must point at your Java Development Kit installation.
+#   JAVA_HOME       (Optional) Must point at your Java Development Kit installation.
 #   MAVEN_OPTS      (Optional) Java runtime options used when Maven is executed.
 #   MAVEN_SKIP_RC   (Optional) Flag to disable loading of mavenrc files.
 # -----------------------------------------------------------------------------
@@ -33,12 +33,24 @@ if [ -z "$MAVEN_SKIP_RC" ] ; then
     . /etc/mavenrc
   fi
 
+  if [ -f /opt/rh/rh-maven36/root/etc/java/maven.conf ] ; then
+    . /opt/rh/rh-maven36/root/etc/java/maven.conf
+  fi
+
   if [ -f "$HOME/.mavenrc" ] ; then
     . "$HOME/.mavenrc"
   fi
 
 fi
 
+if [ -f /opt/rh/rh-maven36/root/usr/share/java-utils/java-functions ] ; then
+  . /opt/rh/rh-maven36/root/usr/share/java-utils/java-functions
+  set_jvm
+  set_javacmd
+fi
+export JAVA_HOME
+export JAVACMD
+
 # OS specific support. $var _must_ be set to either true or false.
 cygwin=false;
 mingw=false;
@@ -63,7 +75,8 @@ done
 
 saveddir=`pwd`
 
-MAVEN_HOME=`dirname "$PRG"`/..
+MAVEN_HOME="${_FEDORA_MAVEN_HOME:-`dirname "$PRG"`/..}"
+unset _FEDORA_MAVEN_HOME
 
 # make it fully qualified
 MAVEN_HOME=`cd "$MAVEN_HOME" && pwd`
-- 
2.21.0