Mac pro下 配置 Maven

1、去Apache官网下载所需的maven安装包,解压
2、打开终端(全程不要关闭终端)
3、cd ~
4、open .bash_profile
在弹出文本文件中输入:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home
export MAVEN_HOME=/Users/songyuelei/Desktop/apache-maven-3.5.4
export CLASS_PATH=.: J A V A H O M E / l i b e x p o r t P A T H = . : PATH: J A V A H O M E / b i n : MAVEN_HOME/bin

5、command+S保存文件,如果没有报错,直接关闭该文本文件
6、在终端输入命令:source .bash_profile
配置完成
如果想查看是否配置成功,可以在终端输入命令:mvn -v,可以看到
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /Users/yangbao/个人/develop/maven/apache-maven-3.3.9
Java version: 1.7.0_75, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: “mac os x”, version: “10.11.6”, arch: “x86_64”, family: “mac”
表示配置成功
其中步骤4,我再网上查到的教程是vi .bash_profile,因为在配置环境变量时已经配置过该文件,所以没有弹出文本文件,而是直接在终端显示出我这个文件中的配置信息,由于本人小白,不知道怎么修改,随便按了几下键盘后,怕出错,直接强制关闭终端,结果重新打开终端后,再次输入vi .bash_profile命令,会出现
E325: ATTENTION
Found a swap file by the name “.bash_profile.swp”
owned by: yangbao dated: Thu Aug 25 13:12:05 2016
file name: ~yangbao/.bash_profile
modified: YES
user name: yangbao host name: yangbaodeMacBook-Pro.local
process ID: 829
While opening file “.bash_profile”
dated: Thu Aug 25 13:00:16 2016

(1) Another program may be editing the same file.
If this is the case, be careful not to end up with two
different instances of the same file when making changes.
Quit, or continue with caution.

(2) An edit session for this file crashed.
If this is the case, use “:recover” or “vim -r .bash_profile”
to recover the changes (see “:help recovery”).
If you did this already, delete the swap file “.bash_profile.swp”
to avoid this message.

Swap file “.bash_profile.swp” already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:
这样的错误信息,强制关闭终端,重启终端后,输入
1、cd ~
2、 rm .*.swp
就可以了

猜你喜欢

转载自blog.csdn.net/syl2850246/article/details/81734735