MAVEN软件下载
http://maven.apache.org/download.cgi
下载并解压
MAVEN_HOME/M2_HOME的环境变量
列如:
系统变量找到Path配置
注意:这里可以用%引入MAVEN_HOME也可以直接指向MAVEN的跟目录。
验证Maven的环境变量
打开cmd命令提示符,输入mvn -version 如下表示表示你在本地搭建完成
仓库的种类:
本地库:开发环境的本地文件夹(windows本地库在C://user/root/.m2/repository)
中央库:maven社区管理的远程资源位置(由各大社区网站服务器存储的世界范围的公用资源)
远程库:开发者设置的自身的远程库(在分布式开发环境中,存储一些中央库没有的资源,方便多个团队,多个人员在不同的位置获取公司公用mavne资源)
修改maven根目录配置文件/conf/settings.xml(配置模板文件)
修改中央库的连接地址,默认是外网地址,所以下载很慢,这里提供一些国内的镜像
-----------CN库
<mirror>
<id>CN</id>
<name>OSChina Central</name>
<url>http://maven.oschina.net/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
-----------repo2
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
-----------net-cn
<mirror>
<id>net-cn</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://maven.net.cn/content/groups/public/</url>
</mirror>
-----------uk
<mirror>
<id>uk</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://uk.maven.org/maven2/</url>
</mirror>
-----------ibiblio
<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>
-----------jboss
<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>
-----------sprintio
<mirror>
<id>sprintio</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>https://repo.spring.io/libs-snapshot/</url>
</mirror>
-----------alimaven(推荐阿里的库目前应该是最全,最快的库)
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
进入IDEA中
File -> settings… ->Buid,Execution,Deployment -> Build Tools ->Maven Maven -> importing
File -> Project Settings 或 右键项目文件 -> Mark Directory As 来进行修改文件夹
刚开始写文章 多多提意见和支持(如有侵权请联系删除)