如何将默认的maven仓库改为阿里的maven仓库
作者:zchtom 时间:2022-09-30 14:16:31
在eclipse中默认的maven,它加载的是国外的镜像,那样速度会比较慢,如果使用国内镜像,比如阿里的中央仓库;速度会快很多。
那如何修改maven仓库呢?(网上有很多如何修改maven仓库的方法,这边我是以 * 作的方法,和参考网上的修改方法)
Step-1:去官网https://maven.apache.org/download.cgi下载一个apache-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项目(我这边已经建好了),打开pom.xml文件,进行查询依赖jar包
这样说明就OK了
来源:https://blog.csdn.net/xingyuqihuan/article/details/79075211
标签:阿里,maven仓库
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
AQS加锁机制Synchronized相似点详解
2023-08-04 22:36:55
![](https://img.aspxhome.com/file/2023/8/57918_0s.png)
实例解析使用Java实现基本的音频播放器的编写要点
2023-11-29 14:54:26
详解Android Flutter中SliverAppBar的使用教程
2023-06-23 12:11:27
![](https://img.aspxhome.com/file/2023/7/97867_0s.jpg)
ShardingSphere jdbc实现分库分表核心概念详解
2023-11-24 12:09:45
![](https://img.aspxhome.com/file/2023/3/59763_0s.png)
Android中如何指定SnackBar在屏幕的位置及小问题解决
2023-08-07 07:56:19
用Flutter开发自定义Plugin的方法示例
2023-07-05 00:19:40
![](https://img.aspxhome.com/file/2023/3/99793_0s.png)
关于MVC与SpringMVC的介绍、区别、执行流程
2023-11-28 02:25:56
java中String的一些方法深入解析
2023-11-25 21:48:56
![](https://img.aspxhome.com/file/2023/2/60332_0s.png)
Java8中的 Lambda表达式教程
2023-10-13 01:32:29
SpringBoot 配合 SpringSecurity 实现自动登录功能的代码
2023-07-22 04:58:22
![](https://img.aspxhome.com/file/2023/6/57626_0s.png)
C#中动态显示当前系统时间的实例方法
2023-06-20 14:46:02
java图片验证码生成教程详解
2021-11-04 13:22:14
![](https://img.aspxhome.com/file/2023/7/60987_0s.jpg)
SpringBoot中多环境配置和@Profile注解示例详解
2023-11-29 05:39:04
简单解析java方法在调用在内存中的执行过程
2022-04-12 15:46:26
![](https://img.aspxhome.com/file/2023/6/59756_0s.png)
SSH原理及两种登录方法图文详解
2023-11-14 11:10:53
![](https://img.aspxhome.com/file/2023/8/59038_0s.png)
C语言实现两个矩阵相乘
2023-07-22 12:41:20
![](https://img.aspxhome.com/file/2023/6/103076_0s.png)
lambda表达式解决java后台分组排序过程解析
2023-11-29 06:03:39
SpringBoot分离打Jar包的两种配置方式
2023-01-30 09:06:59
C++形参与实参的区别实例解析
2023-11-02 23:39:05
SpringBoot配置GlobalExceptionHandler全局异常处理器案例
2023-06-11 12:14:36
![](https://img.aspxhome.com/file/2023/6/60626_0s.png)