1.官网下载maven
下载链接:https://maven.apache.org/download.cgi
2.修改maven的settings.xml内容(文件在maven->conf->settings.xml)
①修改镜像仓库地址为阿里镜像,原有镜像地址加载太慢,更换如下
<!-- 阿里云镜像 -->
<mirrors>
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
<mirror>
<id>ibiblio</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
</mirror>
<mirror>
<id>jboss-public-repository-group</id>
<mirrorOf>central</mirrorOf>
<name>JBoss Public Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
</mirror>
<mirror>
<id>google-maven-central</id>
<name>Google Maven Central</name>
<url>https://maven-central.storage.googleapis.com
</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!-- 中央仓库在中国的镜像 -->
<mirror>
<id>maven.net.cn</id>
<name>oneof the central mirrors in china</name>
<url>http://maven.net.cn/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
②修改maven本地仓库。pom中添加依赖,加载时先到本地仓库加载,本地仓库没有去镜像地址下载依赖
<localRepository>C:/work/maven/repository</localRepository>
3.IntellijIdea 修改本地maven
file->Settings->Build,Execution,Deployment->Build Tools -> Maven
将maven-home-path 中修改为下载在本地的maven,setting.xml文件选择为maven-conf下的setting.xml文件,如果你setting.xml中设置了本地仓库,local repository处会自动加载。
1.Maven设置
最新推荐文章于 2024-07-20 22:09:54 发布