<b>前置條件</b>
1.jdk配置成功
<b>作者本人環境配置</b>
1.macbook pro (13-inch, late 2016, four thunderbolt 3 ports)
2.mac sierra 10.12.4
3.jdk 1.8.0_111
4.時間:2017-04-17
<b>操作過程</b>
2.解壓到合适的目錄中(我放在/users/xxx/workspaces/apache-maven-3.5.0)
3.配置maven變量
3.1 touch .bash_profile 建立配置檔案(如果已經有則無需建立)
查詢辦法 cd ~ 進入使用者根檔案夾
ls -a 查詢所有檔案(包括隐藏檔案)
3.2 vim .bash_profile 編輯配置檔案
輸入‘a’,進入編輯模式
輸入
export m2_home=/users/handongchen/workspaces/apache-maven-3.5.0
export m2=$m2_home/bin
export path=$m2:$path
esc 後,輸入':wq' 儲存退出(:q! 不儲存退出)
3.3 重新整理source .bash_profile或者登出使環境變量生效
3.4 驗證mvn -version 出現版本資訊則說明成功
4.myeclipse 下maven使用
4.1 打開myeclipse, 進入偏好設定-preference-myeclipse-maven4myeclipse
設定maven安裝路徑
![](https://img.laitimes.com/img/__Qf2AjLwojIjJCLyojI0JCLicWZwpmLyIzYxYTNhZTY1QTMkZ2YjFGOmNzN5ITM4ETOiBDZhRTNmRGMwUzYk9CXt92Yu4GZjlGbh5SZslmZxl3Lc9CX6MHc0RHaiojIsJye.jpeg)
4.2 設定目前庫位址
4.3 建立maven工程