mvn -version is displaying -bash: /usr/local/bin/mvn: No such file or directory. Any idea how I can fix this?
It looks like you have all of the necessary ingredients. You simply need to source your profile so that those changes take effect. (You can do this with . ~/.bash_profile
.)
It is possible that your shell cached a previous version of mvn
. This can happen if you add an item to your path after something of the same name has been used before. In that case, as Etan pointed out in the comments, you can just hash -r
, to clear things up. (This doesn't seem to be what you were seeing, but is worth trying in the future if you add maven 3 and mvn -version
keeps showing version 2.)
To get Maven 3 running, it should just be these steps. Just, with your path having the maven 3 directory instead of the maven 2 one.
seeker
Craving for knowledge and whatever follows as a result . :)
Updated on June 28, 2022Comments
-
seeker almost 2 years
I was trying to upgrade from Maven 2 to Maven 3.1 on os x mavericks. I tried using
brew install maven
, thinking it would upgrade maven to the latest version. However that didnt help. It showed the sameNo such file or directory
message. Following this,I uninstalled the maven(installed through brew) by doingbrew rm maven
.However, now I cannot seem to get back either version of maven when I try
mvn -v
, I get thhe output-bash: /usr/local/bin/mvn: No such file or directory
The following is the content of my
bash_profile
export M2_HOME=/usr/local/apache-maven-2.2.1/ export JBOSS_HOME=/Applications/whp-jboss-cluster-5 export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/ export TOMCAT_HOME=/Library/Tomcat/ export PATH=$PATH:$M2_HOME/bin:$JBOSS_HOME/bin:$JAVA_HOME:$TOMCAT_HOME
Any idea on how I can fix this and get to maven 3 would be appreciated.
-
mahmoud mehdi over 5 yearsI was trying to delete an old maven version when I faced this issue. the hash -r solved the problem for me after deleting the mvn folders. +1