eclipse Maven installation and configuration (detail)

Here maven to use for the eclipse, so you need to make sure you are a computer and have eclipse installed JDK and configured the environment variables can be used normally.

First, download
the proposal directly Quguan network download: https://maven.apache.org/download.cgi
Note: You may consider using the latest version, mainly for stability of the software.
1, here is the latest version available direct
Here Insert Picture Description, 2, of course, we can also find the version of history, looking down you will find archives,
Here Insert Picture Description
3, click on the archives, you can see all the historical versions, here I chose 3.6 .1 version
Here Insert Picture Description

4. Once you have downloaded only need to unzip it. My installation path is: D: \ java \ maven \ apache-maven-3.6.1
Here Insert Picture Description

Second, the configuration environment variable
1, variable in the new system environment variables and assigns
the variable name: MAVEN_HOME,
variable value: D: \ java \ maven \ apache-maven-3.6.1 ( own installation path of maven)
Here Insert Picture Description
2, editing environment variable Path, added:% MAVEN_HOME% \ bin
Here Insert Picture Description
3, maven so far has been installed and configured the environment variables, check whether the installation was successful by DOS commands using the command: mvn -v
Here Insert Picture Description
this way, you can successfully display the version information that shows that when successfully installed

Third, configure maven local repository
1, in your installation path (mine is: D: \ java \ maven \ apache-maven-3.6.1) , the new repository folder to the local maven repository
Here Insert Picture Description

2, found settings.xml file in the installation path, as: D: \ java \ maven \ conf directory \ Apache-3.6.1-Maven
Here Insert Picture Description
. 3, with Notepad, shortcut keys Ctrl + F can be found to find the following a piece of code

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

localRepository default node is commented out, it needs to move beyond the notes, now you need to value localRepository node to the directory created before D: \ the Java \ Maven \-the Apache Maven-3.6.1 \ Repository
Here Insert Picture Description
4, localRepository node is used to configure a local warehouse, local warehouse in fact, played a buffer role, its default address is C: \ users \ username .m2.
When we get the package from the jar maven in time, maven will first look in the local warehouse, if the local warehouse is returned; if not from the remote repository to obtain package and stored in a local library.
Here Insert Picture Description
In addition, we run mvn install in a maven project, the project will be automatically packaged and installed to the local repository. . .
4, run the DOS command

mvn help:system

Here Insert Picture Description

Configuration is successful, then your repository folder there will be some file path: D: \ java \ maven \ apache-maven-3.6.1 \ repository

Fourth, configured to eclipse maven environment
1, followed by Window-> Preferences-> Maven-> Installations, click on the right side of the Add
Here Insert Picture Description, 2, set up maven installation directory, and then click Done
Here Insert Picture Description
3, select the maven just added, and click Apply and Close
Here Insert Picture Description
4. open Window-> Preferences-> Maven-> User Settings , arranged below and click Apply and close
Here Insert Picture Description

Now, you can start your tour of the code

Published 32 original articles · won praise 24 · views 5900

Guess you like

Origin blog.csdn.net/qq_43663493/article/details/104663638