在MAC中配置maven

1、去Apache官网下载所需的maven安装包,解压
2、打开终端(全程不要关闭终端)
3、cd ~
4、open .bash_profile
在弹出文本文件中输入:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home
export MAVEN_HOME=/Users/yangbao/个人/develop/maven/apache-maven-3.3.9
export CLASS_PATH=.:$JAVA_HOME/lib
export PATH=.:$PATH:$JAVA_HOME/bin:$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
就可以了
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值