简体   繁体   English

无法获取Maven安装路径

[英]Unable to get the maven installation path

I have installed maven 3.6.0 in my mac using homebrew . 我已经使用homebrew在Mac中安装了maven 3.6.0 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. 如果要查找安装文件夹,则mvn --version显示路径。

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

Even better, try: 更好的是,尝试:

which mvn

Reason why whereis couldn't return is explained here . 之所以whereis不能回,说明这里

Download the Maven, for example apache-maven-3.xx-bin.tar.gz. 下载Maven,例如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 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. 2.2 –在环境变量中设置Maven命令。 Update ~/. 更新〜/。 bash_profile – create this file if doesn't exist. bash_profile –创建该文件(如果不存在)。

$ vim ~/.bash_profile $ vim〜/ .bash_profile

Copy 复制

~/.bash_profile 在〜/ .bash_profile

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

Copy 复制

Restart the terminal. 重新启动终端。 Test it. 测试一下。

Then whereis mvn will work 然后MVN将在哪里工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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