Table of Contents generated with DocToc
配置文件路径:
{maven安装路径}/libexec/conf/settings.xml
搜索mirror即可定位到镜像配置位置,添加如下配置:
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
**敲黑板:**配置好了maven之后,idea中的maven选项一定要切换到本地的maven,默认会使用idea自带的maven进行拉取,异常的慢
**敲黑板:**项目级镜像配置,在项目pom.xml => project 下添加如下配置
<repositories>
<repository>
<id>nexus-aliyun</id>
<name>nexus-aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
配置文件末尾添加如下配置:
栗子1
<localRepository>D:\maven\MyRepository</localRepository>
栗子2
<localRepository>/opt/maven-lib</localRepository>
注意:让idea创建项目时使用本地仓库:在idea的maven配置中,为vm options 添加启动参数:-DarchetypeCatalog=local
搜索maven,点击Runner一栏,在VM Options输入框里写上 “-DarchetypeCatalog=local”,
通过上述配置之后,IDEA创建项目可能依然很慢,原因是maven会去下载一个核心xml文件,此文件在中央仓库,提前下载好放到本地仓库的m2目录下即可解决问题
archetype-catalog.xml