This article mainly explains how to configure and use the Maven that comes with IDEA. If you don't want to use the Maven that comes with the compiler, you can download, install, and then continue to configure.
Download link (soon):
http://maven.apache.org/download.cgi
How to download the .zip file by selecting the version you need, unzip it, the steps are the same
You can see in IDEA's default Maven, the installation address and version of Maven
Configure the environment variable
MAVEN_HOME
D:\IDEA\plugins\maven\lib\maven3
Add path
Win10 directly add a variable
%MAVEN_HOME%\bin
For Win7, you need to add both before and after;
;%MAVEN_HOME%\bin;
Verify, open cmd to view the Maven version, if the correct Maven version appears, it means the configuration is correct
Choose a suitable folder as the local Maven repository, here is a new repo folder
Modify the settings.xml file
Modify the address of the local Maven warehouse
Release the commented code and modify the path
Modify remote warehouse address
Let go of the comment and change it to alimaven. . . . . . Not much to explain
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
Configure JDK version
Just let go of the comment and just replace it
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
The configuration in IDEA is as follows, check the Override, select the settings.xml file just configured; generally the local warehouse below will be automatically refreshed, if there is no refresh, you can modify it manually
Verification, create a simple Maven project, add a jar package in pom.xml
<dependencies>
<dependency>
<groupId>junit</groupId
<artifactId>junit</artifactId>
<version>4.9</version>
<scope>test</scope>
</dependency>
</dependencies>
After refreshing, successfully download the jar to the local warehouse and import it