Maven配置阿里云镜像settings.xml文件

mvaen的环境变量配置
环境配置
右键我的电脑-属性-高级系统设置-环境变量-系统变量-Path
Path—编辑

新建—输入本机maven的地址—确定—确定—确定

检查环境变量是否配置成功
Win + R 然后输入cmd 打开命令行,输入如下命令
1
mvn -v
1
出现下图就配置成功啦

3、配置maven 下载仓库
使用maven时,会自动下载所需要的jar包。方便我们管理我们需要指定下载资源的存放路径
指定仓库位置
打开 maven 所在目录下的settings.xml (我的路径D:\apache-maven-3.3.9\conf)
1
2
找到下列代码-------52行左右
<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
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
-->
1
2
3
4
5
6
7
8
9
<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
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
-->
<!-- 加上下列代码 路径可自定义(用于存放maven下载的包)-->
<localRepository>D:\apache-maven-3.3.9\repository</localRepository>
1
2
3
4
5
6
7
8
9
10
4、配置maven 国内镜像
默认镜像下载速度很慢,本帖使用阿里云提供镜像
同理---打开 maven 所在目录下的settings.xml (我的路径D:\apache-maven-3.3.9\conf)
1
找到下列代码-------147行左右
<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>
-->
</mirrors>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<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/groups/public/</url>
</mirror>
</mirrors>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
5、配置完成
可以愉快的使用maven啦~~
————————————————
版权声明:本文为CSDN博主「小飞飞y」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/acsiont/article/details/99762592


__EOF__

本文作者stdxxd
本文链接https://www.cnblogs.com/stdxxd/p/16128039.html
关于博主:评论和私信会在第一时间回复。或者直接私信我。
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角推荐一下。您的鼓励是博主的最大动力!
posted @   stdxxd  阅读(3513)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
点击右上角即可分享
微信分享提示