1. 配置本地的仓库
- 找到maven文件夹下面的conf里面的settings.xml文件
- 找到里面的localRepository标签,可以看到默认位置是:
<!-- 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>/Users/light6/mavenRepo</localRepository>
之后如下图:
maven本地仓库.png
2. 配置阿里云为maven的中央仓库
因为在中央仓库下载jar的时候很慢,便用阿里云提供的maven仓库下载jar可以快很多
- 找到在settings.xml文件里的mirrors节点
<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>
- 在mirrors节点添加如下子节点:
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
之后如下图:
maven阿里云.png
网友评论