【轉載】 Idea-Maven的配置使用及預設倉庫修改
轉載出處-https://www.cnblogs.com/Silencepeng/p/7444012.html
保留參考使用,如果侵權請告知刪除
一、下載maven的包
http://www.apache.org/
1.在網頁中開啟上面的網址,進入下面的頁面
2.拖動滾動條往下拉,找到maven
進入之後,點選Download
3.選擇windows版本的連結下載壓縮包
下載完成之後解壓出來
二、配置環境變數
解壓完成之後,新增兩個環境變數:
1.滑鼠右鍵點選 我的電腦--》屬性--》高階系統設定--》環境變數 然後新建一個系統變數
再找到之前的path系統變數 編輯
完成之後,dos視窗(管理員) 輸入 mvn -version 回車
出現以下頁面代表成功
三、編輯maven配置檔案
1.找到maven檔案中的settings.xml 檔案 右鍵點選編輯
如果你的編輯檔案不是以規範的格式顯示
可以去百度下載一個notepad++ 安裝之後用notepad++開啟此檔案
四、配置IDEA
開啟idea,在檔案中開啟設定
五、建立maven
開啟檔案新建一個專案
點選FInish之後,在右下角會出現此提示 點選自動匯入
.settings.xml 修改可更換下載速度更快的國內映象
<?xml version="1.0"?>
<settings>
<localRepository>C:\Users\XJkon\.m2\repository</localRepository><!--需要改成自己的maven的本地倉庫地址-->
<!--預設倉庫地址http://repo1.maven.org/maven2/-->
<!--為倉庫列表配置的下載映象列表。優先從此目錄下載 -->
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!--第二優先映象 -->
<repositories>
<repository>
<id>nexus</id>
<name>local private nexus</name>
<url>http://maven.oschina.net/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<!--外掛下載映象 -->
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>local private nexus</name>
<url>http://maven.oschina.net/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>