Detailed steps for Maven installation and configuration of local warehouse, mirror source, and environment variables

Reference video:
Dark Horse Programmer 2023 new version of JavaWeb development tutorial, realizing the whole process of javaweb enterprise development
[Xiao Feifei Series] The latest Maven practice Tutorial - Practical Project Construction Tool

1. Download the Maven installation package

Note that the jdk environment must be installed before installing maven:
JDK11 version installation package download address

1. Download the installation package and store it in a path without Chinese characters

Maven installation package download address

2. Extract the compressed package to the current folder. The contents of the folder are as follows:

2. Configure Maven’s local warehouse (native warehouse)

1. Open the settings.xml file in the conf folder with Notepad or vscode compiler.

2. Find line 53 < localRepository > /path/to/local/repo < / localRepository>, which is the code to modify the local warehouse location

3. Copy one line of this code and modify the content in the localRepository tag to the path you want to store it in.

3. Configure the image source (accelerate the download of jar packages)

1. Open the settings.xml file in the conf folder with Notepad or vscode compiler.

2. Find the mirrors code block on lines 148-161

3. Add the desired private server address in the code block. Here, Alibaba Cloud’s private server address is used as a reference:

<mirror>  
	<id>alimaven</id>  
	<name>aliyun maven</name>  
	<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
	<mirrorOf>central</mirrorOf>          
</mirror>

4. Configure Maven environment variables (to facilitate the execution of maven instructions in any directory)

1. Copy the Maven installation directory

2. Open Computer Properties -> Advanced System Settings -> Environment Variables, and create a new Maven environment variable.

3. In the path variable, add the bin directory of the maven installation path

5. Test whether the Maven installation is successful

1. Enter the mvn -v command in cmd to view the Maven version number

mvn -v

Guess you like

Origin blog.csdn.net/qq_51688022/article/details/134772304