一、下載官方maven-3.5.4程序包:
下載地址:http://maven.apache.org/download.cgi
單擊apache-maven-3.5.4-bin.zip這個壓縮包下載
二、解壓縮maven程序包:
建議解壓縮並重命名至D:\maven-3.5.4
建議建立資源文件夾:D:\repository
三、修改maven配置文件中的資源文件夾地址:
用文本軟件打開D:\maven-3.5.4\conf文件夾下的settings.xml
在
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->
下添加如下內容
<localRepository>D:\repository</localRepository>
四、Ecplise程序中配置maven:
①菜單欄-Window-Preferences-Maven-Installations-Add-Directory-本地maven文件夾(D:\maven-3.5.4)-Finish-選擇maven-3.5.4
②(可略)菜單欄-Window-Preferences-Maven-User Settings-Global Settings-Browse-本地maven配置文件地址(D:\maven-3.5.4\conf\settings.xml)
③菜單欄-Window-Preferences-Maven-User Settings-User Settings-Browse-本地maven配置文件地址(D:\maven-3.5.4\conf\settings.xml)
④菜單欄-Window-Preferences-Maven-User Settings-Update Settings
此時Local Respository變成步驟三配置的地址,如果沒有可以進行下一步刷新一下
⑤菜單欄-Window-Preferences-Maven-User Settings-Reindex
Apply and Close。
--------------------------------------------完成。