美文网首页
阿里云maven公共代理库

阿里云maven公共代理库

作者: 伊夫_艾尔斯 | 来源:发表于2020-04-02 14:52 被阅读0次

国内使用maven最好使用代理,jar包下载速度才够快.
阿里云公共代理库应该是使用最广泛的,下面贴一个使用指南:
https://help.aliyun.com/document_detail/102512.html?spm=a2c40.aliyun_maven_repo.0.0.36183054179UqC

\color{red}{特别提示}

最好使用public仓库,因为public仓库是central仓和jcenter仓的聚合仓,
传统的方式,很多都是使用的central仓,这会导致部分jar下载出现问题!

例如:
<!-- 中文转拼音 -->
<dependency>
    <groupId>com.github.promeg</groupId>
    <artifactId>tinypinyin</artifactId>
    <version>2.0.3</version>
</dependency>

配置指南

打开maven的配置文件(windows机器一般在maven安装目录的conf/settings.xml),在<mirrors></mirrors>标签中添加mirror子节点:

<mirror>
    <id>aliyunmaven</id>
    <mirrorOf>*</mirrorOf>
    <name>阿里云公共仓库</name>
    <url>https://maven.aliyun.com/repository/public</url>
</mirror>

如果想使用其它代理仓库,可在<repositories></repositories>节点中加入对应的仓库使用地址。以使用spring代理仓为例:

<repository>
    <id>spring</id>
    <url>https://maven.aliyun.com/repository/spring</url>
    <releases>
        <enabled>true</enabled>
    </releases>
    <snapshots>
        <enabled>true</enabled>
    </snapshots>
</repository>

相关文章

网友评论

      本文标题:阿里云maven公共代理库

      本文链接:https://www.haomeiwen.com/subject/ojjxphtx.html