eclipse - maven environment build

Step 1: Download maven
Log in to the maven official website https://maven.apache.org/

Go to the download page, click download
After downloading, unzip it and put it in a directory location that you customize
I created a new maven directory on the E drive
Configure the MAVEN_HOME variable
Will be added to the path path %MAVEN_HOME%\bin\
cmd window to verify whether the installation was successful
    Type mvn -v


Modify the setting.xml file in the installation directory

Third, configure Maven local warehouse

1. Create a new maven-repository folder in the E:\maven directory, which is used as the local library of maven.


2. Open the E:\maven\apache-maven-3.5.3\conf\settings.xml file and find the following line of code:

<localRepository>/path/to/local/repo</localRepository>

The localRepository node is commented out by default, you need to move it outside the comment, and then change the value of the localRepository node to the directory E:\maven \maven-repository we created in 3.1.


3. The localRepository node is used to configure the local repository. The local repository actually acts as a cache. Its default address is C:\Users\username.m2.

When we get the jar package from maven, maven will first look in the local repository, and return if the local repository has it; if not, get the package from the remote repository and save it in the local repository.

In addition, we run mvn install in the maven project, and the project will be automatically packaged and installed into the local repository.



Configure the mirror address of Alibaba Cloud's central warehouse (it may make you faster in China)


4. Run the DOS command
If the previous configuration is successful, then some files will appear in E:\maven\maven-repository\repository.
5. Copy the configuration file to the default warehouse location (can be omitted)

Fourth, configure the Maven environment of Eclipse

1. Eclipse open Window->Preferences->Maven->Installations, click Add on the right.

2. Set the maven installation directory, then Finish
3. Select the maven you just added and Apply.
4. Open Window->Preferences->Maven->User Settings, configure as follows and Apply:
If the setting.xml under the local .m2 path is not configured, the global configuration path can be set directly in user_setting

The environment is set up



 



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325388974&siteId=291194637