maven安裝配置概述:
1.下載並解壓安裝包
2.配置環境變量並檢查
3.修改配置文件(主要改倉庫地址,國內鏡像倉庫下jar包更快些)
1.從官網下載並解壓安裝包
根據需求選擇下載,win下載zip,linux下載tar,下面兩個是源碼
下載完后解壓
2.配置環境變量並檢查
配置環境變量,把bin目錄配到path里
win+r 進入cmd,輸入mvn -v,出現如下提示代表環境配置沒問題
3.最后一步,修改配置文件
進入settings.xml
3.1修改本地倉庫
1 <!-- localRepository 2 | The path to the local repository maven will use to store artifacts. 3 | 4 | Default: ${user.home}/.m2/repository 5 <localRepository>本地倉庫地址,隨便建個文件夾就好</localRepository> 6 --> 7 <localRepository>G:\MAVEN\Repository</localRepository>
3.2添加國內鏡像源(私有倉庫)
國內鏡像下jar包快點
1 <!-- 阿里雲倉庫 --> 2 <mirror> 3 <id>alimaven</id> 4 <mirrorOf>central</mirrorOf> 5 <name>aliyun maven</name> 6 <url>http://maven.aliyun.com/nexus/content/repositories/central/</url> 7 </mirror> 8 9 <!-- 中央倉庫1 --> 10 <mirror> 11 <id>repo1</id> 12 <mirrorOf>central</mirrorOf> 13 <name>Human Readable Name for this Mirror.</name> 14 <url>http://repo1.maven.org/maven2/</url> 15 </mirror> 16 17 <!-- 中央倉庫2 --> 18 <mirror> 19 <id>repo2</id> 20 <mirrorOf>central</mirrorOf> 21 <name>Human Readable Name for this Mirror.</name> 22 <url>http://repo2.maven.org/maven2/</url> 23 </mirror>
eclipse,Idea主要改下配置文件位置
打完收工,就是這么簡單