版权声明:若博客内容对你有些许帮助,请在本页左下角,进行援助。 一毛不嫌少,一块不嫌多。 《文章中所出现软件下载,若失效,加群523575753获取 》。-.- 《 本文为博主原创文章,未经博主允许不得转载》。另附:打开支付宝首页搜索“523248402”,即可领红包。偶尔会有大红包哦! https://blog.csdn.net/Vchen_hao/article/details/70212740
1.下载maven安装包。
官网:http://mirror.bit.edu.cn/apache/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.zip
2.配置环境变量。
新建变量名:MAVEN_HOME 变量值:D:\maven\apache-maven-3.5.0(这是我的MAVEN路径)
编辑变量名:Path 在最前面加上:%MAVEN_HOME%\bin;(注意,最后要有个”;”作为分隔符)
完成之后,在命令行输入:mvn -version查看是否有以下内容,如果有表示配置成功。
3.Maven数据仓库的配置
MAVEN中还有一个重要的配置就是数据仓库的路径配置,我们找到MAVEN的安装路径,进入conf–>打开settings.xml,找到localRepository标签,此时是被注释掉的,我们解除注释,然后配置一个路径,例如:d:/maven/MavenRepository/maven_jar,这样以后MAVEN管理下载的jar包都会在这个路径下。
4.修改maven仓库。
如下,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>
-->
</mirrors>
在maven的settings.xml 文件里配置mirrors的子节点,修改如下mirror
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
5.Eclipse中集成Maven
单击:Windows——>preferences——>Maven——>Installations
将maven路径加载进来。
单击:Windows——>preferences——>Maven——>User Settings
将maven 的配置文件 settings 加载进来。
单机 OK即完成配置。