首页 > 代码库 > 解决IDEA中Maven加载依赖包慢的问题
解决IDEA中Maven加载依赖包慢的问题
原理:maven加载jar包过程,默认的是先扫描本地仓库,若本地仓库没有,则扫描远程仓库下载。默认的conf/settings.xml文件没有配置远程仓库,所以扫描的是maven的中央仓库(在国外),所以慢。
解决方法:配置国内镜像(如阿里云的镜像)
修改conf/settings.xml文件,配置阿里云镜像代码
1 <mirrors> 2 <!-- mirror 3 | Specifies a repository mirror site to use instead of a given repository. The repository that 4 | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used 5 | for inheritance and direct lookup purposes, and must be unique across the set of mirrors. 6 | 7 <mirror> 8 <id>mirrorId</id> 9 <mirrorOf>repositoryId</mirrorOf>10 <name>Human Readable Name for this Mirror.</name>11 <url>http://my.repository.com/repo/path</url>12 </mirror>13 -->14 15 <mirror>16 <id>alimaven</id>17 <name>aliyun maven</name>18 <url>http://maven.aliyun.com/nexus/content/groups/public/</url>19 <mirrorOf>central</mirrorOf>20 </mirror>21 22 <mirror> 23 <id>uk</id> 24 <mirrorOf>central</mirrorOf> 25 <name>Human Readable Name for this Mirror.</name> 26 <url>http://uk.maven.org/maven2/</url> 27 </mirror>28 29 <mirror>30 <id>CN</id>31 <name>OSChina Central</name>32 <url>http://maven.oschina.net/content/groups/public/</url>33 <mirrorOf>central</mirrorOf>34 </mirror>35 36 <mirror>37 <id>nexus</id>38 <name>internal nexus repository</name>39 <!-- <url>http://192.168.1.100:8081/nexus/content/groups/public/</url>-->40 <url>http://repo.maven.apache.org/maven2</url>41 <mirrorOf>central</mirrorOf>42 </mirror>43 44 </mirrors>
解决IDEA中Maven加载依赖包慢的问题
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。