1.官网(https://maven.apache.org/)上下载maven
之前下载过了,这边就不去下载了(虽然版本不一样,配置都是差不多的)
2.解压好后配置环境变量
配置好后,查看是否配置成功(运行cmd,输入mvn -v)
3.配置本地仓库以及镜像(settings.xml)
新建一个Repository,存放本地仓库
<mirrors>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>nexus-aliyun</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
<mirror>
<id>alibaba</id>
<name>alibaba</name>
<url>https://repo1.maven.org/maven2/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
4.在idea上验证是否配置成功
在idea中进行配置,File----》Settings下
在pom.xml中写入以下配置代码,可实现自动导入对应的jar包(可在maven仓库里面搜索spring:https://mvnrepository.com/)
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.0.2.RELEASE</version>
</dependency>