简体   繁体   中英

Unable to get the maven installation path

I have installed maven 3.6.0 in my mac using homebrew . When I try

mvn --version 

in my terminal, I get the

Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-25T05:41:47+11:00)
Maven home: /usr/local/Cellar/maven/3.6.0/libexec
Java version: 11.0.2, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home
Default locale: en_AU, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.3", arch: "x86_64", family: "mac"

But when I try ,

whereis mvn

I dont receive anything in return? Can someone let me know what I have done wrong in the installation

If you're looking for the installation folder, mvn --version shows you the path.

Maven home: /usr/local/Cellar/maven/3.6.0/libexec

Even better, try:

which mvn

Reason why whereis couldn't return is explained here .

Download the Maven, for example apache-maven-3.xx-bin.tar.gz. Extracts it,

tar -xvf apache-maven-3.xx-bin.tar.gz $pwd /Users/mkyong/apache-maven-3.xx

Copy

2.2 – Set Maven command in environment variable. Update ~/. bash_profile – create this file if doesn't exist.

$ vim ~/.bash_profile

Copy

~/.bash_profile

export M2_HOME=/Users/mkyong/apache-maven-3.xx export PATH=$PATH:$M2_HOME/bin

Copy

Restart the terminal. Test it.

Then whereis mvn will work

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