1. Download the installation package
Go to the official website to download the latest version of the installation package, the latest version is 3.9.0
official website link: Maven – Download Apache Maven
2. Installation
Put the downloaded maven installation package into the directory you specify for decompression:
3. Configure environment variables
1. Right click on This PC and select Properties
2. Select Advanced System Settings
3. Select environment variables
Note: You can also search for "environment variables" in the search box of Windows 11, and choose to edit the system environment variables
4. Click New in System Variables
5. Create a new MAVEN_HOME variable and click OK
变量名: MAVEN_HOME
变量值: C:\softwore\apache-maven-3.9.0
注意:变量值就是步骤二的maven解压目录,大家一定要写自己的
6. Find Path in the system variable, then select and click Edit
7. Click New to create the following variables:
8. Then click OK all the way. The verification process is to open the DOS command window (Windows+R key, then enter cmd), enter the command mvn -version, and the following results will be successful
Fourth, configure the local warehouse and Alibaba Cloud mirror
1. Open the maven installation directory, create a new folder repository, and the folder location can be arbitrary
2. Open the conf folder in the installation directory, and edit the settings.xml file in the directory
3. Find localRepository, open the comment, and then configure the local warehouse directory created in step 1
<localRepository>C:\softwore\apache-maven-3.9.0\repository</localRepository>
4. Set the Alibaba Cloud mirror in the mirrors tab
<!-- 配置阿里云镜像 -->
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>