Can not change update-alternatives mvn
8,006
I had modified the ~/.profile
PATH
variable, so the only thing I had to do is to comment out the line and log in again.
.profile
...
#export PATH=/opt/maven/apache-maven-3.3.9/bin:$PATH
...
Related videos on Youtube
Author by
Joe
Updated on September 18, 2022Comments
-
Joe almost 2 years
Ubuntu 14.04
After installing and changing the version of
mvn
via `update-alternatives, the configuration remains unchanged.Steps
Install new version mvn
sudo update-alternatives --install /usr/bin/mvn mvn /opt/maven/apache-maven-3.5.0/bin/mvn 100
Check 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
Change alternative to new one
$ 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
Check mvn version
$ 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
command output:$ type -a mvn mvn is /opt/maven/apache-maven-3.3.9/bin/mvn mvn is /usr/bin/mvn
-
Admin about 7 yearsAdd the output of
type -a mvn
, please. -
Admin about 7 years@muru I added it to the question
-
Admin about 7 yearsYour
PATH
probably has/opt/maven/apache-maven-3.3.9/bin
in it. Remove it and try again. -
Admin about 7 yearsIt seems to be this, but I commented with # in .profile but it is still apearing in env and set, I'll try rebooting
-
Admin about 7 yearsyou might have to login again.
-
Admin about 7 yearsYes, that was the problem!
-
Admin about 7 yearsYou can post what you edited from your
.profile
as an answer. -
Admin over 5 yearsThis question solved my problem :D Thanks for the very detailed question ;)