4

I want to upgrade to a newer version of maven. For that I first want to remove the existing version of maven in the computer as told here. I tried:

sudo apt-get remove maven2

but it says:

$ sudo apt-get remove maven2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'maven2' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 19 not upgraded.

Then I typed mvn -version just to make sure that maven is not present, but to my surprise I found:

$ mvn -version
The program 'mvn' can be found in the following packages:
* maven
* maven2

Unsure of what to do next, I did locate maven and deleted everything that was present in /usr/share/maven-repo. But after this, if i type mvn -version, it shows the same output that was shown above.

How can I automatically remove maven?

BeastOfCaerbannog
  • 12,964
  • 10
  • 49
  • 77
Sanchit Jain
  • 150
  • 1
  • 3
  • 13
  • use `sudo apt-get purge maven2` and check again. – αғsнιη Sep 22 '14 at 09:22
  • Unfortunately it is giving the same output what it was giving without using purge. – Sanchit Jain Sep 22 '14 at 09:31
  • how did you install maven? – Private Sep 22 '14 at 09:37
  • 1
    It seems `maven` is not installed in your system. You can skip the 1 step and go ahead with remaining steps in the tutorial you mentioned – aneeshep Sep 22 '14 at 09:38
  • 1
    try : sudo apt-get remove --auto-remove maven and sudo apt-get purge --auto-remove maven – Private Sep 22 '14 at 09:38
  • @Private and @aneeshep: i did not install maven. I also dont know how its installed. I installed eclipse few hours ago. I am not sure if it automatically installs maven. But if it is not installed then `mvn -version` should give some error message – Sanchit Jain Sep 22 '14 at 09:42
  • @Private : no luck with the commands. " sudo apt-get remove --auto-remove maven and sudo apt-get purge --auto-remove maven " They are giving the same output as `sudo apt-get remove maven` – Sanchit Jain Sep 22 '14 at 09:46
  • @SanchitJain Maven isn't installed. `mvn -version` actually throws an error message, saying where you can get the program from. – s3lph Sep 22 '14 at 12:24
  • Yes you are right. Thankyou. – Sanchit Jain Sep 22 '14 at 14:06

3 Answers3

3

Actually it shows that you already removed it. You can go ahead and use:

sudo apt-get install maven
BeastOfCaerbannog
  • 12,964
  • 10
  • 49
  • 77
Ammar
  • 131
  • 3
2
sudo apt-get purge maven2 

Run this command and problem will be resolved.

muru
  • 193,181
  • 53
  • 473
  • 722
SangamAngre
  • 131
  • 3
1

Try

sudo apt-get remove maven

instead of maven2.

Pablo Bianchi
  • 14,308
  • 4
  • 74
  • 117
Deepak N
  • 111
  • 3