revans/bash-it — pull request #165 by nwinkler (2012-10-22 12:18:09+00:00)
Title: Support multiple Maven versions

Support switching between multiple Maven installations.

Call `usemvn` to list the available versions.

Call `usemvn 3.0.4` to switch to the installed version 3.0.4 in the current shell session.

The function checks the directory defined by the variable `$MAVEN_INSTALL_ROOT` (or `/usr/local` if undefined) for Maven installations matching the directory pattern `apache-maven-*`. When calling it with a specific version, it adjusts both the `$PATH` and the `$MAVEN_HOME` variable.

Please do not use the `$M2_HOME` variable, as it interferes with this function.

Credit for this function goes to Stephen Connolly (http://javaadventure.blogspot.com/2011/03/my-magic-maven-and-ant-version.html)