Skip to content

Instantly share code, notes, and snippets.

@rubenghio
Last active November 9, 2022 18:18
Show Gist options
  • Save rubenghio/4693802 to your computer and use it in GitHub Desktop.
Save rubenghio/4693802 to your computer and use it in GitHub Desktop.
Using Alternatives for MAVEN versions
[rghio@localhost ~]$ su -
[root@localhost ~]$ alternatives --install /usr/bin/mvn mvn ${MAVEN_HOME_2}/bin/mvn 120
[root@localhost ~]$ alternatives --install /usr/bin/mvn mvn ${MAVEN_HOME_3}/bin/mvn 120
[root@localhost ~]$ alternatives --config mvn
There are 2 programs which provide 'mvn'.
Selection Command
-----------------------------------------------
*+ 1 /opt/apache-maven-2.2.1/bin/mvn
2 /opt/apache-maven-3.0.4/bin/mvn
[rghio@localhost ~]$ mvn --version
Apache Maven 2.2.1 (r801777; 2009-08-06 16:16:01-0300)
Java version: 1.7.0_11
Java home: /usr/java/jdk1.7.0_11/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "3.7.4-204.fc18.x86_64" arch: "amd64" Family: "unix"
[root@localhost ~]$ alternatives --config mvn
There are 2 programs which provide 'mvn'.
Selection Command
-----------------------------------------------
*+ 1 /opt/apache-maven-2.2.1/bin/mvn
2 /opt/apache-maven-3.0.4/bin/mvn
Enter to keep the current selection[+], or type selection number: 2
[root@localhost ~]$ mvn --version
Apache Maven 3.0.4 (r1232337; 2012-01-17 05:44:56-0300)
Maven home: /opt/apache-maven-3.0.4
Java version: 1.7.0_11, vendor: Oracle Corporation
Java home: /usr/java/jdk1.7.0_11/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.7.4-204.fc18.x86_64", arch: "amd64", family: "unix"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment