From 33f60925bded5c992e23b3543bfa54dc69b8bd18 Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Mon, 22 Oct 2012 14:07:19 +0200 Subject: [PATCH] Added documentation and check for environment variable to point to Maven install root. By default, it's using /usr/local, where it expects to find the various Maven versions in directories named "apache-maven-*". If you use a different install location, please define the variable MAVEN_INSTALL_ROOT to point to the install root. --- plugins/available/maven.plugin.bash | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/available/maven.plugin.bash b/plugins/available/maven.plugin.bash index f32fc12a..664da599 100644 --- a/plugins/available/maven.plugin.bash +++ b/plugins/available/maven.plugin.bash @@ -3,10 +3,19 @@ about-plugin 'maven helper functions' usemvn () { - local MAVEN_INSTALL_ROOT="/usr/local" + about 'Switches between available Maven versions for the current shell. Lists the available Maven versions if called without a parameter. The root directory for Maven installations can be defined using the variable MAVEN_INSTALL_ROOT. If this is not defined, /usr/local is assumed. The Maven directories under this directory are expected to be named apache-maven-*' + group 'maven' + param '1: Maven version to switch to' + example 'usemvn 3.0.4' + + if [ -z "$MAVEN_INSTALL_ROOT" ] + then + local MAVEN_INSTALL_ROOT="/usr/local" + fi if [ -z "$1" -o ! -x "$MAVEN_INSTALL_ROOT/apache-maven-$1/bin/mvn" ] then + echo "Looking for Maven installations in $MAVEN_INSTALL_ROOT/apache-maven-*" local prefix="Syntax: usemvn " for i in $MAVEN_INSTALL_ROOT/apache-maven-* do