maven下载使用及环境变量配置步骤【非常详细】

3.5.4的下载地址
https://archive.apache.org/dist/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.zip

一 下载

官网地址https://maven.apache.org/
点击download
在这里插入图片描述

选择以Previous Releases前的版本,点击archives 归档
在这里插入图片描述

选择需要的版本
在这里插入图片描述

点击binaries

在这里插入图片描述

下载src.zip
在这里插入图片描述

二 使用

找个全英文目录解压,找到conf下面的settings.xml文件,编辑文件
在这里插入图片描述

1 找到localRepository标签,复制一份出来,设置自己的本地仓库位置

比如我的仓库位置D:\software\repository

在这里插入图片描述

2 设置镜像地址

找到mirrors标签,将下面的内容复制进去

		<mirror>
            <id>huawei</id>
            <name>huawei repository</name>
            <url>https://mirrors.huaweicloud.com/repository/maven/</url>
            <mirrorOf>central</mirrorOf>
        </mirror>
        <mirror>
            <id>alimaven</id>
            <name>aliyun maven</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
            <mirrorOf>central</mirrorOf>
        </mirror>
		<mirror>
		    <id>nexus-tencentyun</id>
		    <mirrorOf>*</mirrorOf>
		    <name>Nexus tencentyun</name>
		    <url>http://mirrors.cloud.tencent.com/nexus/repository/maven-public/</url>
		</mirror> 
        <mirror>
            <id>uk</id>
            <mirrorOf>central</mirrorOf>
            <name>Human Readable Name for this Mirror.</name>
            <url>http://uk.maven.org/maven2/</url>
        </mirror>
        <mirror>
            <id>CN</id>
            <name>OSChina Central</name>
            <url>http://maven.oschina.net/content/groups/public/</url>
            <mirrorOf>central</mirrorOf>
        </mirror>
        <mirror>
            <id>nexus</id>
            <name>internal nexus repository</name>
            <url>http://repo.maven.apache.org/maven2</url>
            <mirrorOf>central</mirrorOf>
        </mirror>

在这里插入图片描述

3 配置maven环境变量

配置MAVEN_HOME
D:\software\apache-maven-3.5.4

在这里插入图片描述

配置path,找到path,编辑->新增->确定
%MAVEN_HOME%\bin
在这里插入图片描述

打开cmd,输入mvn -v,显示版本代表环境配置成功
在这里插入图片描述

4 配置idea,点击file–>settings–>mavne–>配置maven的路径和xml文件

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/lh155136/article/details/126207620