IDEA configuration Maven tutorial (super detailed version~)


Preface

This article introduces how to configure Maven in IDEA


1. Maven download

First, we enter the maven official website . After entering the web page, click Download to download
Insert image description here
. Download the installation-free version and unzip it. Unzip it to any directory on the disk. Try not to use Chinese names as shown below:
Insert image description here

2. Configure Maven environment variables

Copy the path where Maven is located, D:\maven\apache-maven-3.6.3, right-click on this computer and select Properties->Advanced System Settings->Environment Variables
Insert image description here

Insert image description here
Create a new system variable
Insert image description here
. The variable name is MAVEN_HOME. The variable value is D:\maven\apache-maven-3.6.3. Click OK.
Insert image description here
Select Path, click Edit
Insert image description here
Insert image description here
and click OK until all dialog boxes are exited. Then open the cmd command line and enter mvn. -v, displaying the maven version number proves that the MAVEN environment variable is configured successfully and can be referenced globally.
Insert image description here

3. Modification of settings.xml configuration file

Find the localRepository tag in the configuration file. This tag configures the location of the local warehouse. You can customize a folder to save it (try not to use Chinese). The maven project will first look for dependencies from the local warehouse. If it cannot be found , and then go to the central warehouse to download, and the downloaded dependency packages will be saved to the local warehouse.
Insert image description here
Then please note that you need to add the Alibaba Cloud mirror to the mirrors tag, because this will greatly increase the speed of downloading our dependencies.
Insert image description here

4. Open IDEA and configure Maven

Select File->Settings...
Insert image description here
Search for Maven
Insert image description here
and perform the following configuration
Insert image description here
, then click Apply and then click OK.
We can import a maven project at will
Insert image description here
and it will automatically download the dependencies. Find the local warehouse and you can see that some of the dependencies have been downloaded
Insert image description here
. So far, in IDEA The configuration of maven has been completed

Guess you like

Origin blog.csdn.net/qq_40187702/article/details/130660992
Recommended