三、maven汇总 发表于 2019-03-21 | 分类于 综合 1. maven安装及配置123456789101112131415161718A. 首先到官网: http://maven.apache.org/download.cgi 去下载zip包。解压后的目录这里为: D:\wwd\apache\apache-maven-3.6.0B. 新建一个M2_HOME的环境变量,值为解压缩路径: D:\wwd\apache\apache-maven-3.6.0 将其添加到Path中: %M2_HOME%\binC. 修改远程中央仓库为阿里仓库: 打开maven解压缩路径下 conf/setting.xml 找到<mirrors> 在其后添加如下内容: <mirror> <id>nexus-aliyun</id> <mirrorOf>central</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror> 这样就能快速下载所需第三方依赖包了。避免从国外服务器下载过慢问题。D. 修改本地仓库位置 Maven会将下载的类库(jar包)放置到本地的一个目录下(默认情况下Maven在本机的仓库位于C:\Users\你的电脑用户账号\.m2\repository) 为了避免C盘被占用空间越来越大。可以将其转移到其他目录。还是打开 conf/setting.xml 找到 localRepository后,添加如下配置: <localRepository>D:\wwd\apache\maven_install_dir</localRepository> 下载的依赖包就都会在该路径下了。