Download the Maven decompression package file to your computer

Download site: http://maven.apache.org/download.cgi

Decompression file directory description:

Bin directory: mvn.bat (run the project), mvnDebug (debug the project)

Boot directory: Maven requires a classloader to run

Conf directory: settings. XML The core configuration file for the entire Maven tool

Lib directory: Maven runs dependent jar packages

Configure environment variables

Prerequisites: the Java environment (jdk1.7 or later) must be installed on the PC. Add the JAVA_HOME variable to the path environment variable.

1. Add the MAVEN_HOME variable to the path of the Maven decompression package

% 2, % MAVEN_HOME/bin; Add to the path environment variable as follows:

3. Run the CMD command, enter MVN -v, and press Enter. If the following information is displayed, the installation is successful.

Set the local Maven repository address

1. Open the Settings. XML file in D:\maven\apache-maven-3.6.3\conf

2. Add the following code:

  <! Maven local repository address -->
  <localRepository>D:\maven\repository</localRepository>
Copy the code

D:\maven\repository D:\maven\repository

Install and configure the M2E plug-in

Note: I am using the eclipse MAR version, it has built-in Maven3.3.3, so now we want to change to our version!

Eclipse toolbar → Windows → Preferences → Maven → Installation, then click “Add…” button

2. Select the maven local repository directory we set earlier

3, switch to the User Settings menu, User Settings select the maven configuration file, such as D:\maven\apache-maven-3.6.3\conf\settings.xml

4. Click Update Settings to Update the Settings, and then click OK to save

5. After configuring Maven, test whether you can browse to maven’s local repository in Eclipse

1. Eclipse toolbar → Windows → Show View → Other, select Maven Repositories under Maven

2. Click OK and you can see the Maven repository view in the information bar, as follows:

Select Local Repository, right-click Rebuild Index, and then see the contents of the Repository

IntelliJ IDEA set maven local repository path

Step 1: In IntelliJ IDEA menu bar, File → Settings

Step 2: Set the path to the Maven local repository and the path to the configuration file, and then click apply or OK