Article directory
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
. 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:
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
Create a new system variable
. The variable name is MAVEN_HOME. The variable value is D:\maven\apache-maven-3.6.3. Click OK.
Select Path, click Edit
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.
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.
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.
4. Open IDEA and configure Maven
Select File->Settings...
Search for Maven
and perform the following configuration
, then click Apply and then click OK.
We can import a maven project at will
and it will automatically download the dependencies. Find the local warehouse and you can see that some of the dependencies have been downloaded
. So far, in IDEA The configuration of maven has been completed