Ubuntu 14.04
Après avoir installé et changé la version de mvn
via `update-alternatives, la configuration reste inchangée.
étapes
Installer la nouvelle version MVN
Sudo update-alternatives --install /usr/bin/mvn mvn /opt/maven/Apache-maven-3.5.0/bin/mvn 100
Vérifier les alternatives
$ Sudo update-alternatives --config mvn
There are 2 choices for the alternative mvn (providing /usr/bin/mvn).
Selection Path Priority Status
------------------------------------------------------------
* 0 /opt/maven/Apache-maven-3.3.9/bin/mvn 100 auto mode
1 /opt/maven/Apache-maven-3.3.9/bin/mvn 100 manual mode
2 /opt/maven/Apache-maven-3.5.0/bin/mvn 10 manual mode
Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /opt/maven/Apache-maven-3.5.0/bin/mvn to provide /usr/bin/mvn (mvn) in manual mode
Changer d'alternative à une nouvelle
$ Sudo update-alternatives --config mvn
There are 2 choices for the alternative mvn (providing /usr/bin/mvn).
Selection Path Priority Status
------------------------------------------------------------
0 /opt/maven/Apache-maven-3.3.9/bin/mvn 100 auto mode
1 /opt/maven/Apache-maven-3.3.9/bin/mvn 100 manual mode
* 2 /opt/maven/Apache-maven-3.5.0/bin/mvn 10 manual mode
Press enter to keep the current choice[*], or type selection number: 2
Vérifier la version MVN
$ mvn --version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: /opt/maven/Apache-maven-3.3.9
Java version: 1.8.0_111, vendor: Oracle Corporation
Java home: /opt/Java/jdk1.8.0_111/jre
Default locale: ca_ES, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-116-generic", Arch: "AMD64", family: "unix"
type
sortie de la commande:
$ type -a mvn
mvn is /opt/maven/Apache-maven-3.3.9/bin/mvn
mvn is /usr/bin/mvn
J'avais modifié la variable ~/.profile
PATH
; la seule chose à faire est donc de commenter la ligne et de vous reconnecter.
. profil
...
#export PATH=/opt/maven/Apache-maven-3.3.9/bin:$PATH
...