下載和安裝idea這裏就不多費篇章了,下載安裝傻瓜式,科學使用的話,網上一堆註冊碼或者綠色文件。
一.配置Maven環境
1.下載apache-maven文件,選擇自己需要的版本,地址: http://mirror.bit.edu.cn/apache/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.zip
2.解壓1所下載文件,本人解壓到:D:\server\maven\apache-maven-3.5.0
3.配置Maven環境變量
a. MAVEN_HOME : D:\server\maven\apache-maven-3.5.0
b.PATH : %MAVEN_HOME%\bin;
c. MAVEN_OPTS : -Xms128m -Xmx512m -Duser.language=zh -Dfile.encoding=UTF-8
4.在CMD中輸入mvn -v,如出現下列信息,表示配置成功。
其中會顯示Java 配置環境以及Maven配置環境
二.修改Maven倉庫路徑
1.在D盤(個人根據自身情況而定)新建文件目錄。
2.配置D:\server\maven\中setting.xml文件,內容如下:
注意外層有一對 mirrors標籤。
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url> http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url> http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url> http://repo1.maven.org/maven2/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url> http://repo2.maven.org/maven2/</url>
</mirror>
<mirror>
<id>ibiblio</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url> http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
</mirror>
<mirror>
<id>jboss-public-repository-group</id>
<mirrorOf>central</mirrorOf>
<name>JBoss Public Repository Group</name>
<url> http://repository.jboss.org/nexus/content/groups/public</url>
</mirror>
<mirror>
<id>google-maven-central</id>
<name>Google Maven Central</name>
<url> https://maven-central.storage.googleapis.com
</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!-- 中央倉庫在中國的鏡像 -->
<mirror>
<id> maven.net.cn</id>
<name>oneof the central mirrors in china</name>
<url> http://maven.net.cn/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
三.IntellIJ IDEA 中配置Maven
Idea 自帶了apache maven,默認使用的是內置maven,所以我們可以配置全局setting,來調整一下配置,比如遠程倉庫地址,本地編譯環境變量等。
主要是,找到在idea安裝目錄下的 plugin/lib/maven目錄,找到conf下的setting,參考上面配置下即可