Write custom directory title here
Set up Maven's local repository
The default address of Maven's local warehouse is located in the C:\Users\username.m2 directory. The volume of the jar package in the warehouse will become larger with the iteration of the project, so I switched the address of the warehouse to the E drive. The specific steps as follows
download maven
Download address: http://maven.apache.org/download.cgi
I downloaded the zip compressed file, as shown below:
Then unzip it, I unzip it to the E drive
Configure environment variables
Click on My Computer -> Properties
Click on Advanced system settings
Click on Environment Variables
Create a new MAVEN_HOME in the system variable, the variable name is
MAVEN_HOME
The variable value is the decompression path just now:
E:\Program Files (x86)\apache-maven-3.8.4\
Double click path in system variable
add in path
%MAVEN_HOME%\bin
Click OK to save
Verify that the installation was successful
win+R to open the console, enter mvn -v, if the following figure appears, the installation is successful
Configure local repository
Open the maven decompressed file and find the settings.xml file under the config directory
Modify the address of the local warehouse to E:\Program Files (x86)\apache-maven-3.8.4\repository
add the following code:
<localRepository>E:\Program Files (x86)\apache-maven-3.8.4\repository</localRepository>
Check if the configuration just now takes effect
Enter in the cmd console
mvn help:system
When the console shows build success, check the maven_repos folder of the D drive again. There are many more files, indicating that the configuration takes effect.
In this way, the local warehouse is successfully configured.
Set up the maven remote repository
Maven's default remote address is
http://my.repository.com/repo/path
Because this address is a foreign website, the speed of downloading the jar package will be very slow. Here I use the address of Alibaba Cloud
Open the maven decompressed file and find the settings.xml file under the config directory
Add the address of Alibaba Cloud in the settings.xml file
<mirror>
<id>aliyunmaven</id>
<mirrorOf>*</mirrorOf>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
Check if the configuration just now takes effect
Type in the console
mvn help:system
When build success appears on the console, the configuration takes effect
Configuring Maven in IntellIJ IDEA
左上角File -> Other Settings -> Default Settings
Find Maven, and change to local configuration:
also check the automatic import
Another: The above is the default configuration of the change, if the project has been introduced, then change the File->Settings...