39

Tried to upgrade maven. Followed this tutorial. Now I am getting thisenter image description here

How does a file exist and not exist?

Dan Cornilescu
  • 39,470
  • 12
  • 57
  • 97
nupac
  • 2,459
  • 7
  • 31
  • 56
  • I did 1. brew update 2. brew search maven 3. brew install maven 4. mvn -version To double check 5. brew upgrade maven => it will throw an error Error: maven 3.5.4 already installed – user1769790 Oct 24 '18 at 22:41

4 Answers4

53

To upgrade to the latest version (if you have one already installed but need to update the version) do the following:

1. brew update
2. brew unlink maven
3. brew install maven

if you then execute the mvn --version command you should see that your version of maven has been upgraded.

EDIT:
If you have an issue with the update (command 1) that goes along the lines of
error: The following untracked working tree files would be overwritten by merge: Library/Formula/...
try this answer from another issue

Community
  • 1
  • 1
Dark Star1
  • 6,986
  • 16
  • 73
  • 121
30

You created a symbolic link from your Downloads directory with a directory that may not exist anymore (or with an incorrect path). The directory /usr/bin/mvn obviously exists but the link is incorrect to the target which leads to the "No such file or directory" error when typing mvm --version.

Go through the tutorial again (which seems ok) but if you fail you could always try using Homebrew with the following commands :

brew update
brew install maven
abronan
  • 3,309
  • 4
  • 29
  • 38
23

if you installed maven in your mac, i use the next command...

>brew upgrade maven

screenshot

JRL
  • 331
  • 2
  • 3
  • 1
    Don't include screenshots on remote sites. Including images in answers is only marginally better. Its generally better to just include the text and use the SO to format it. – danblack Jan 31 '19 at 23:30
1

I will be fixed if you run below commands

brew update
brew install maven

Still issue is exist check your M2_HOME path. It should set to M2_HOME=/usr/local/bin/mvn

venkat7668
  • 2,657
  • 1
  • 22
  • 26