这篇文章给大家介绍如何将默认maven仓库修改为阿里maven仓库,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。
在eclipse中默认的maven,它加载的是国外的镜像,那样速度会比较慢,如果使用国内镜像,比如阿里的中央仓库;速度会快很多。
那如何修改maven仓库呢?(网上有很多如何修改maven仓库的方法,这边我是以我操作的方法,和参考网上的修改方法)
Step-2:下载完成之后,在apache-maven-3.5.0/conf文件夹下新建一个settings.xml,并在apache-maven-3.5.0文件夹下创建一个repos文件夹,用于下面在eclipse中将其设置为仓库的路径
而settings.xml的内容可以在网上找一个,settings.xml如下
?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>E:\apache-maven-3\apache-maven-3.5.0\repos</localRepository>
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
</servers>
<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>
-->
<mirror>
<id>alimaven</id>
<mirrorOf>*</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
</mirrors>
<profiles>
</profiles>
</settings>
其中核心的部分为:
<mirror>
<id>alimaven</id>
<mirrorOf>*</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
Step-3:对eclipse进行修改
在window—》preferences
完成之后:切换到maven的窗口
然后重新建立索引
关于如何将默认maven仓库修改为阿里maven仓库就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。
网络异常,请检查网络