第一步:下載Apache-Maven安裝包并更改設(shè)置文件
1.訪問官網(wǎng)地址:http://maven.apache.org/index.html
2.點(diǎn)擊左側(cè)Download菜單
3.下載apache-maven-3.5.4-bin.zip
4.解壓至E盤(可隨意設(shè)定)傲绣,路徑為E:\apache-maven-3.5.4
5.打開E:\apache-maven-3.5.4\conf\settings.xml(建議設(shè)置)
【1】設(shè)定maven依賴的本地存儲(chǔ)路徑,主要是為了利于查找膨桥,原來的路徑為:C:\Users\Administrator.m2\repository
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->
<!--設(shè)置如下-->
<localRepository>E:/apache-maven-3.5.4/repository</localRepository>
【2】添加國內(nèi)maven鏡像
<mirrors>
<!-- mirror
| Specifies a repository mirror site to use instead of a given repository. The repository that
| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
|
<mirror>
<id>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://my.repository.com/repo/path</url>
</mirror>
-->
<!--添加如下-->
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
第二步:配置Maven環(huán)境變量以及設(shè)置Eclipse中Maven的路徑
1.鼠標(biāo)右擊【計(jì)算機(jī)】或【我的電腦】,點(diǎn)擊屬性->高級(jí)系統(tǒng)設(shè)置->環(huán)境變量->新建
M2_HOME=E:\apache-maven-3.5.4
同時(shí)設(shè)置在原來的Path路徑下添加;%M2_HOME%\bin
2.點(diǎn)擊開始->運(yùn)行->輸入cmd->命令行輸入mvn -version進(jìn)行驗(yàn)證是否安裝成功
3.打開Eclipse袭蝗,依次點(diǎn)擊Window->Preferences->Maven->User Settings,
并設(shè)置User Settings為E:\apache-maven-3.5.4\conf\settings.xml
至此波势,Maven的安裝與配置就完成啦!接下來就可以創(chuàng)建Maven項(xiàng)目琳拭,感謝閱讀刻伊,祝你好運(yùn)露戒!