83d12c
From 056c94f86450c7c27f5bb11f98653c73bfe3d8e4 Mon Sep 17 00:00:00 2001
83d12c
From: Michael Simacek <msimacek@redhat.com>
83d12c
Date: Wed, 1 Feb 2017 14:54:26 +0100
83d12c
Subject: [PATCH 1/4] Adapt mvn script
83d12c
83d12c
---
83d12c
 apache-maven/src/bin/mvn | 17 +++++++++++++++--
83d12c
 1 file changed, 15 insertions(+), 2 deletions(-)
83d12c
83d12c
diff --git a/apache-maven/src/bin/mvn b/apache-maven/src/bin/mvn
83d12c
index a554c6617..0c07ba6e2 100755
83d12c
--- a/apache-maven/src/bin/mvn
83d12c
+++ b/apache-maven/src/bin/mvn
83d12c
@@ -22,7 +22,7 @@
83d12c
 #
83d12c
 # Environment Variable Prerequisites
83d12c
 #
83d12c
-#   JAVA_HOME       Must point at your Java Development Kit installation.
83d12c
+#   JAVA_HOME       (Optional) Must point at your Java Development Kit installation.
83d12c
 #   MAVEN_OPTS      (Optional) Java runtime options used when Maven is executed.
83d12c
 #   MAVEN_SKIP_RC   (Optional) Flag to disable loading of mavenrc files.
83d12c
 # -----------------------------------------------------------------------------
83d12c
@@ -33,12 +33,24 @@ if [ -z "$MAVEN_SKIP_RC" ] ; then
83d12c
     . /etc/mavenrc
83d12c
   fi
83d12c
 
83d12c
+  if [ -f /etc/java/maven.conf ] ; then
83d12c
+    . /etc/java/maven.conf
83d12c
+  fi
83d12c
+
83d12c
   if [ -f "$HOME/.mavenrc" ] ; then
83d12c
     . "$HOME/.mavenrc"
83d12c
   fi
83d12c
 
83d12c
 fi
83d12c
 
83d12c
+if [ -f /usr/share/java-utils/java-functions ] ; then
83d12c
+  . /usr/share/java-utils/java-functions
83d12c
+  set_jvm
83d12c
+  set_javacmd
83d12c
+fi
83d12c
+export JAVA_HOME
83d12c
+export JAVACMD
83d12c
+
83d12c
 # OS specific support. $var _must_ be set to either true or false.
83d12c
 cygwin=false;
83d12c
 mingw=false;
83d12c
@@ -63,7 +75,8 @@ done
83d12c
 
83d12c
 saveddir=`pwd`
83d12c
 
83d12c
-MAVEN_HOME=`dirname "$PRG"`/..
83d12c
+MAVEN_HOME="${_FEDORA_MAVEN_HOME:-`dirname "$PRG"`/..}"
83d12c
+unset _FEDORA_MAVEN_HOME
83d12c
 
83d12c
 # make it fully qualified
83d12c
 MAVEN_HOME=`cd "$MAVEN_HOME" && pwd`
83d12c
-- 
83d12c
2.21.0
83d12c