Skip to content

Instantly share code, notes, and snippets.

@gcaracuel
Last active April 27, 2017 09:49
Show Gist options
  • Save gcaracuel/5fbbe2fd40f5a5893348d505b56fb1e8 to your computer and use it in GitHub Desktop.
Save gcaracuel/5fbbe2fd40f5a5893348d505b56fb1e8 to your computer and use it in GitHub Desktop.
Install and manage more than one version of Maven
# Ensure $M2 & $M2_HOME are not set
# Ensure Maven system package is not installed
cd /tmp
wget http://ftp.cixug.es/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
wget https://archive.apache.org/dist/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz
wget https://archive.apache.org/dist/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz
cd /opt
sudo tar zvxf /tmp/apache-maven-3.3.9-bin.tar.gz
sudo tar zvxf /tmp/apache-maven-3.3.3-bin.tar.gz
sudo tar zvxf /tmp/apache-maven-3.5.0-bin.tar.gz
sudo update-alternatives --install /usr/bin/mvn mvn /opt/apache-maven-3.3.3/bin/mvn 333 --slave /usr/bin/mvnDebug mvnDebug /opt/apache-maven-3.3.3/bin/mvnDebug
sudo update-alternatives --install /usr/bin/mvn mvn /opt/apache-maven-3.3.9/bin/mvn 339 --slave /usr/bin/mvnDebug mvnDebug /opt/apache-maven-3.3.9/bin/mvnDebug
sudo update-alternatives --install /usr/bin/mvn mvn /opt/apache-maven-3.5.0/bin/mvn 350 --slave /usr/bin/mvnDebug mvnDebug /opt/apache-maven-3.5.0/bin/mvnDebug
sudo update-alternatives --config mvn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment