First, the need to prepare something
-
JDK
-
Eclipse
-
Maven package
Second, download and install
4. Maven program go https://maven.apache.org/download.cgi download the latest version:
5.
-
File storage directory
C:\Program Files\apache-maven-3.6.1
: -
New environment variables
MAVEN_HOME
, assignmentC:\Program Files\apache-maven-3.6.1
-
Editing environment variables
Path
, additional%MAVEN_HOME%\bin\
** Note: ** If this pattern is the figure, put %MAVEN_HOME%\bin\
into the last, have a previous ;
connection
If this form
New direct %MAVEN_HOME%\bin\
- Test whether the installation was successful
open cmd, entermvn -version
At this point, the environment configuration
Third, configure the local repository
1. Open you have maven installation directory, locate settings.xml
the file in its interior can search for <localRepository>/path/to/local/repo</localRepository>
such a sentence (the picture shows my installation directory corresponding to your own)
you can see, this sentence is the initial is disabled
by default ocalRepository node is commented out, it needs to move beyond the comments, and then we changed the value localRepository node directory that you have created
2. I generally related to the code in a specific disc, the directory to I F:\maven
, below
3.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.
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
If the previous configuration is successful, F:\maven
there will be some files.
5. maven amended to mirror Ali, the final configuration file
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>D:\java\maven</localRepository>
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
</settings>
code show as below
Configuration eclipse
Generally installed after the maven, the figure addresses autocomplete
But this is his address the default address, if you own the same configuration with the above too, that you need to change your own configuration file path
After you configure the default maven also need to specify the use of, or otherwise use the original default eclipse maven.
Find Maven -> Installations -> Add extraction path to find the maven, add in it. As shown below
This completes the configuration of the eclipse maven