一、指定本地仓库
1.新建一个文件夹当做本地仓库
D:\JAVA\Maven\Repository 我的文件夹
2. 在settings.xml中添加localRepository标签
settings.xml位于maven安装目录中C:\Software\Maven\apache-maven-3.5.4\conf目录下
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->
<localRepository>D:\JAVA\Maven\Repository</localRepository>
二、配置阿里云镜像
在settings.xml文件中的mirrors下添加mirror标签
<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>
-->
<mirror>
<id>nexus-aliyun</id>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
初次创建Maven工程会从阿里云镜像上下载一些jar包