maven repository国内镜像地址

本文介绍如何配置Maven的setting.xml文件以及Gradle的仓库源,以使用阿里云Maven仓库和Spring官方仓库,提高依赖下载速度并确保项目顺利构建。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.

修改setting.xml

 
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
 
<repositories>
<repository>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>


2.

 repositories {
    maven { url "https://repo.spring.io/libs-release" }
    maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
    mavenLocal()
    mavenCentral()
  }

3.

maven repository国内镜像地址


参考:

https://segmentfault.com/q/1010000007373569

http://blog.youkuaiyun.com/xxzblog/article/details/53313737

http://jingyan.baidu.com/article/f96699bbd4a7b3894f3c1b72.html

### Maven 国内镜像配置方法 为了提高依赖项下载速度,可以使用国内Maven 镜像服务器替代默认的中央仓库。以下是几个常用的国内 Maven 镜像地址: - **阿里云** - 地址: `https://maven.aliyun.com/repository/public/`[^1] - **网易 Maven 仓库** - 地址: `http://mirrors.163.com/maven/repository/` - **中科大 Mirror** - 地址: `https://maven.mirrors.sjtug.sjtu.edu.cn/repo/` #### 修改全局设置文件 对于大多数情况来说,在用户的主目录下的 `.m2/settings.xml` 文件中添加如下配置即可生效。 ```xml <mirrors> <!-- 阿里云 --> <mirror> <id>aliyun</id> <name>Aliyun Repository</name> <url>https://maven.aliyun.com/repository/public/</url> <mirrorOf>central</mirrorOf> </mirror> <!-- 网易 (如果需要的话可以选择其他镜像源)--> <!--<mirror>--> <!--<id>netease</id>--> <!--<name>NetEase Public Repo</name>--> <!--<url>http://mirrors.163.com/maven/repository/</url>--> <!--<mirrorOf>central</mirrorOf>--> <!--</mirror>--> <!-- 中科大 --> <!--<mirror>--> <!--<id>sjtug</id>--> <!--<name>SJTUG Public Repo</name>--> <!--<url>https://maven.mirrors.sjtug.sjtu.edu.cn/repo/</url>--> <!--<mirrorOf>central</mirrorOf>--> <!--</mirror>--> </mirrors> ``` 上述 XML 片段展示了如何定义一个名为 "aliyun" 的镜像条目并将其指向阿里云提供的公共库。注意 `<mirrorOf>` 标签指定了该镜像是用来替换哪个官方资源,默认情况下应设为 `"central"` 表示取代 Maven 官方中心仓库。 当遇到 Jenkins 插件开发过程中因网络原因导致无法正常获取 archetype-catalog.xml 文件的情况时,通过以上方式切换到更稳定的国内镜像能够有效解决问题[^2]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值