Fix incorrect maven home path

This commit is contained in:
qiegewala 2020-03-06 15:10:15 +08:00
parent 67cad44e0a
commit 4e9e6c7c51
2 changed files with 77 additions and 1 deletions

69
Adapt-mvn-script.patch Normal file
View File

@ -0,0 +1,69 @@
From 46041685a82b861bc8616bb603e341adb740a302 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/3] Adapt mvn script
---
apache-maven/src/bin/mvn | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/apache-maven/src/bin/mvn b/apache-maven/src/bin/mvn
index a554c66..818cf70 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 /etc/java/maven.conf ] ; then
+ . /etc/java/maven.conf
+ fi
+
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
+if [ -f /usr/share/java-utils/java-functions ] ; then
+ . /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`
@@ -102,7 +115,7 @@ if [ ! -x "$JAVACMD" ] ; then
exit 1
fi
-CLASSWORLDS_JAR=`echo "${MAVEN_HOME}"/boot/plexus-classworlds-*.jar`
+CLASSWORLDS_JAR=`build-classpath plexus-classworlds`
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# For Cygwin, switch paths to Windows format before running java
--
2.17.1

View File

@ -4,7 +4,7 @@
Name: maven Name: maven
Epoch: 1 Epoch: 1
Version: 3.5.4 Version: 3.5.4
Release: 3 Release: 5
Summary: A tool can be used for building and managing any Java-based project Summary: A tool can be used for building and managing any Java-based project
License: ASL 2.0 License: ASL 2.0
URL: http://maven.apache.org/ URL: http://maven.apache.org/
@ -13,6 +13,7 @@ Source1: maven-bash-completion
Source2: mvn.1 Source2: mvn.1
Patch0000: Revert-MNG-6335-Update-Mockito-to-2.12.0.patch Patch0000: Revert-MNG-6335-Update-Mockito-to-2.12.0.patch
Patch0001: Adapt-mvn-script.patch
BuildRequires: maven-local mvn(com.google.guava:guava:20.0) mvn(com.google.inject:guice::no_aop:) mvn(commons-cli:commons-cli) BuildRequires: maven-local mvn(com.google.guava:guava:20.0) mvn(com.google.inject:guice::no_aop:) mvn(commons-cli:commons-cli)
BuildRequires: mvn(commons-jxpath:commons-jxpath) mvn(javax.annotation:jsr250-api) mvn(javax.inject:javax.inject) BuildRequires: mvn(commons-jxpath:commons-jxpath) mvn(javax.annotation:jsr250-api) mvn(javax.inject:javax.inject)
@ -131,5 +132,11 @@ fi
%ghost %{_mandir}/man1/mvn*.gz %ghost %{_mandir}/man1/mvn*.gz
%changelog %changelog
* Fri Mar 06 2020 lihao <lihao129@huawei.com> - 1:3.5.4-5
- Fix incorrect maven home path
* Fri Mar 06 2020 lihao <lihao129@huawei.com> - 1:3.5.4-4
- Use Mockito 1.x instead of 2.x
* Fri Dec 6 2019 lingsheng <lingsheng@huawei.com> - 1:3.5.4-3 * Fri Dec 6 2019 lingsheng <lingsheng@huawei.com> - 1:3.5.4-3
- Package init - Package init