本文为转载,请支持原作者:查看原文
在日常使用Idea进行开发中,经常会遇到因网络问题导致maven中的依赖无法导入的问题,将拉取的地址改为国内地址可以解决此问题:
以阿里的maven镜像为例:
http://maven.aliyun.com/nexus/content/groups/public/
Widnows中,打开Idea,依次打开:
Settings -> 搜索maven
Mac中:
Intellij IDEA -> Preferences -> 搜索maven
自定义的配置文件,要在 ”User setttings file“ 处进行设置,按照路径找到这个目录,在未配置的情况下,该文件是不存在的,可新建 settings.xml 文件,并将以下内容保存到文件中:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
</settings>
至此,自定义镜像完成!干杯!