简体   繁体   中英

mvn: command not found - terminal

I am using a Mac Pro machine and want to install maven. So here is what I am doing. First I download the appropriate .zip. I unzip it and in terminal I type

Theodosioss-MacBook-Pro:~ theo$ export M2_HOME=/Users/theo/apache- 
maven-3.5.4

and

Theodosioss-MacBook-Pro:~ theo$ export 
PATH=$PATH:/Users/theodosiostziomakas/apache-maven-3.5.4

Then I check if maven is installed but I get this.

mvn --version
-bash: mvn: command not found

How to properly fix this?

Try

export PATH=$PATH:/Users/theodosiostziomakas/apache-maven-3.5.4/bin

mvn executable is inside bin folder.

您尚未指定正确的目录,请尝试以下操作

export PATH=/YOUR_LOCAL_LOCATION/apache-maven-3.5.4/bin:$PATH

First you need to add maven path to your PATH variable correctly,as others have said

export PATH=/YOUR_LOCAL_LOCATION/apache-maven-3.5.4/bin:$PATH

then you need to call source /etc/profile (pay attention to check the user type, root or no root ) to make it into effect and then open a new terminal for test

The following works for me. Changes are done to .bash - .profile did not work on my mac

Update the config in ~/.profile

export M2_HOME=<PATH>/apache-maven-X.Y>Z
export M2=$M2_HOME/bin
export PATH=$M2:$PATH

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM