You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by if...@apache.org on 2015/01/26 20:22:23 UTC
maven git commit: .mvn/ for project specific jvm options and maven
parameters
Repository: maven
Updated Branches:
refs/heads/project-basedir [created] 4b32ef2cb
.mvn/ for project specific jvm options and maven parameters
Signed-off-by: Igor Fedorenko <if...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/4b32ef2c
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/4b32ef2c
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/4b32ef2c
Branch: refs/heads/project-basedir
Commit: 4b32ef2cb84251270b334dc68ad2a0778867182d
Parents: 786285f
Author: Igor Fedorenko <if...@apache.org>
Authored: Mon Jan 26 14:22:05 2015 -0500
Committer: Igor Fedorenko <if...@apache.org>
Committed: Mon Jan 26 14:22:05 2015 -0500
----------------------------------------------------------------------
apache-maven/src/bin/mvn | 9 ++++--
apache-maven/src/bin/mvn-common.sh | 48 +++++++++++++++++++++++++++++
apache-maven/src/bin/mvnDebug | 9 ++++--
apache-maven/src/bin/mvnyjp | 22 ++++++-------
apache-maven/src/main/assembly/bin.xml | 1 +
5 files changed, 74 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven/blob/4b32ef2c/apache-maven/src/bin/mvn
----------------------------------------------------------------------
diff --git a/apache-maven/src/bin/mvn b/apache-maven/src/bin/mvn
index 1ed3024..70fa2f9 100755
--- a/apache-maven/src/bin/mvn
+++ b/apache-maven/src/bin/mvn
@@ -189,9 +189,14 @@ if $cygwin; then
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
fi
+. "$M2_HOME/bin/mvn-common.sh"
+export MAVEN_BASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
+MAVEN_CONFIG=$(concat "$MAVEN_BASEDIR/.mvn/maven.config")
+MAVEN_OPTS="$(concat "$MAVEN_BASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
-MAVEN_CMD_LINE_ARGS="$@"
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS
exec "$JAVACMD" \
@@ -199,4 +204,4 @@ exec "$JAVACMD" \
-classpath "${M2_HOME}"/boot/plexus-classworlds-*.jar \
"-Dclassworlds.conf=${M2_HOME}/bin/m2.conf" \
"-Dmaven.home=${M2_HOME}" \
- ${CLASSWORLDS_LAUNCHER} "$@"
+ ${CLASSWORLDS_LAUNCHER} $MAVEN_CONFIG "$@"
http://git-wip-us.apache.org/repos/asf/maven/blob/4b32ef2c/apache-maven/src/bin/mvn-common.sh
----------------------------------------------------------------------
diff --git a/apache-maven/src/bin/mvn-common.sh b/apache-maven/src/bin/mvn-common.sh
new file mode 100755
index 0000000..adac638
--- /dev/null
+++ b/apache-maven/src/bin/mvn-common.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+# TODO ideally, this should contain all logic common to mvn* shell scripts
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+function find_maven_basedir {
+ local basedir=$(pwd)
+ local wdir=$(pwd)
+ while [ "$wdir" != '/' ]; do
+ wdir=$(cd $wdir/..; pwd)
+ if [[ -d "$wdir"/.mvn ]]; then
+ basedir=$wdir
+ break
+ fi
+ done
+ echo "${basedir}"
+}
+
+# concatenates all lines of a file
+function concat {
+ local file=$1
+ local result=
+ if [ -f "$file" ]; then
+ while read -r line; do
+ result="$result $line"
+ done < "$file"
+ fi
+ echo "$result"
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/4b32ef2c/apache-maven/src/bin/mvnDebug
----------------------------------------------------------------------
diff --git a/apache-maven/src/bin/mvnDebug b/apache-maven/src/bin/mvnDebug
index 291f81f..14dc4b5 100755
--- a/apache-maven/src/bin/mvnDebug
+++ b/apache-maven/src/bin/mvnDebug
@@ -193,9 +193,14 @@ if $cygwin; then
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
fi
+. "$M2_HOME/bin/mvn-common.sh"
+export MAVEN_BASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
+MAVEN_CONFIG=$(concat "$MAVEN_BASEDIR/.mvn/maven.config")
+MAVEN_OPTS="$(concat "$MAVEN_BASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
-MAVEN_CMD_LINE_ARGS="$@"
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS
exec "$JAVACMD" \
@@ -204,4 +209,4 @@ exec "$JAVACMD" \
-classpath "${M2_HOME}"/boot/plexus-classworlds-*.jar \
"-Dclassworlds.conf=${M2_HOME}/bin/m2.conf" \
"-Dmaven.home=${M2_HOME}" \
- ${CLASSWORLDS_LAUNCHER} "$@"
+ ${CLASSWORLDS_LAUNCHER} $MAVEN_CONFIG "$@"
http://git-wip-us.apache.org/repos/asf/maven/blob/4b32ef2c/apache-maven/src/bin/mvnyjp
----------------------------------------------------------------------
diff --git a/apache-maven/src/bin/mvnyjp b/apache-maven/src/bin/mvnyjp
index faf3412..d64979a 100755
--- a/apache-maven/src/bin/mvnyjp
+++ b/apache-maven/src/bin/mvnyjp
@@ -34,14 +34,6 @@
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
-QUOTED_ARGS=""
-while [ "$1" != "" ] ; do
-
- QUOTED_ARGS="$QUOTED_ARGS \"$1\""
- shift
-
-done
-
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /etc/mavenrc ] ; then
@@ -204,11 +196,19 @@ fi
MAVEN_OPTS="-agentpath:$YJPLIB=onexit=snapshot,onexit=memory,tracing,onlylocal $MAVEN_OPTS"
+. "$M2_HOME/bin/mvn-common.sh"
+export MAVEN_BASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
+MAVEN_CONFIG=$(concat "$MAVEN_BASEDIR/.mvn/maven.config")
+MAVEN_OPTS="$(concat "$MAVEN_BASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+
+# Provide a "standardized" way to retrieve the CLI args that will
+# work with both Windows and non-Windows executions.
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
+export MAVEN_CMD_LINE_ARGS
+
exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "${M2_HOME}"/boot/plexus-classworlds-*.jar \
"-Dclassworlds.conf=${M2_HOME}/bin/m2.conf" \
"-Dmaven.home=${M2_HOME}" \
- ${CLASSWORLDS_LAUNCHER} $QUOTED_ARGS
-
-
+ ${CLASSWORLDS_LAUNCHER} $MAVEN_CONFIG "$@"
http://git-wip-us.apache.org/repos/asf/maven/blob/4b32ef2c/apache-maven/src/main/assembly/bin.xml
----------------------------------------------------------------------
diff --git a/apache-maven/src/main/assembly/bin.xml b/apache-maven/src/main/assembly/bin.xml
index b2aa900..6b862f8 100644
--- a/apache-maven/src/main/assembly/bin.xml
+++ b/apache-maven/src/main/assembly/bin.xml
@@ -74,6 +74,7 @@ under the License.
<outputDirectory>bin</outputDirectory>
<includes>
<include>m2</include>
+ <include>mvn-common.sh</include>
<include>mvn</include>
<include>mvnDebug</include>
<!-- This is so that CI systems can periodically run the profiler -->