From 16de378374a4893ae10a7a3a111dda5ad0614c8e Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Mon, 22 Oct 2012 13:54:00 +0200 Subject: [PATCH] Added function to switch between Maven versions. Base version taken from here: http://javaadventure.blogspot.com/2011/03/my-magic-maven-and-ant-version.html --- plugins/available/maven.plugin.bash | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 plugins/available/maven.plugin.bash diff --git a/plugins/available/maven.plugin.bash b/plugins/available/maven.plugin.bash new file mode 100644 index 00000000..f32fc12a --- /dev/null +++ b/plugins/available/maven.plugin.bash @@ -0,0 +1,28 @@ +cite about-plugin +about-plugin 'maven helper functions' + +usemvn () +{ + local MAVEN_INSTALL_ROOT="/usr/local" + + if [ -z "$1" -o ! -x "$MAVEN_INSTALL_ROOT/apache-maven-$1/bin/mvn" ] + then + local prefix="Syntax: usemvn " + for i in $MAVEN_INSTALL_ROOT/apache-maven-* + do + if [ -x "$i/bin/mvn" ]; then + echo -n "$prefix$(basename $i | sed 's/^apache-maven-//')" + prefix=" | " + fi + done + echo "" + else + if [ -z "$MAVEN_HOME" ] + then + export PATH=$MAVEN_INSTALL_ROOT/apache-maven-$1/bin:$PATH + else + export PATH=$(echo $PATH|sed -e "s:$MAVEN_HOME/bin:$MAVEN_INSTALL_ROOT/apache-maven-$1/bin:g") + fi + export MAVEN_HOME=$MAVEN_INSTALL_ROOT/apache-maven-$1 + fi +} \ No newline at end of file