1.配置环境变量如下
maven所在的目录
export PATH=/Users/documents/projectTools/apache-maven-3.3.9/bin:$PATH
2.用的是系统自带的JDK
CafeMacBook-Pro:~ Cafe$ java -version
java version "1.7.0_75"
Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)
3.操作过程
3.1 下载了apache-maven-3.3.9 解压到了/Users/documents/projectTools/apache-maven-3.3.9路径
3.2 使用vi ~/.bash_profile 命令编辑文件。添加1中提到的配置
3.3 保存完成关闭的时候提示这个不可编辑,强制保存并退出了。
3.4 source ~/.bash_profile 使用这个命令是文件生效
3.5 执行 mvn -v 提示command not found。
3.6 新开一个窗口之后也提示command not found
3.7 /Users/documents/projectTools/apache-maven-3.3.9/bin 下面有个mvn文件,双击之后提示:
======提示信息开始======
Last login: Fri Jul 1 14:21:09 on ttys000
CafeChuandeMacBook-Pro:~ Cafe$ /Users/Cafe/Documents/projectTools/apache-maven-3.3.9/bin/mvn ; exit;
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.102 s
[INFO] Finished at: 2016-07-01T14:26:46+08:00
[INFO] Final Memory: 5M/245M
[INFO] ------------------------------------------------------------------------
----提示信息结束-----
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format : or :[:]:. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException
logout
[进程已完成]
======提示结束======