Development environment to build maven

First, the need to prepare something

  1. JDK

  2. Eclipse

  3. Maven package

Second, download and install
4. Maven program go https://maven.apache.org/download.cgi download the latest version:
5.Here Insert Picture Description

  1. File storage directory C:\Program Files\apache-maven-3.6.1:

  2. New environment variables MAVEN_HOME, assignmentC:\Program Files\apache-maven-3.6.1
    Here Insert Picture Description

  3. Editing environment variables Path, additional%MAVEN_HOME%\bin\

Here Insert Picture Description

Here Insert Picture Description

** Note: ** If this pattern is the figure, put %MAVEN_HOME%\bin\into the last, have a previous ;connection

If this form
Here Insert Picture Description

New direct %MAVEN_HOME%\bin\

  1. Test whether the installation was successful
    open cmd, entermvn -version
    Here Insert Picture Description

At this point, the environment configuration

Third, configure the local repository
1. Open you have maven installation directory, locate settings.xmlthe 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)
Here Insert Picture Description
you can see, this sentence is the initial is disabled
Here Insert Picture Description
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

Here Insert Picture Description

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:\maventhere will be some files.

Here Insert Picture Description

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
Here Insert Picture Description

Configuration eclipse

Generally installed after the maven, the figure addresses autocomplete

Here Insert Picture Description

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

Here Insert Picture Description

Here Insert Picture Description

This completes the configuration of the eclipse maven

Detecting whether the installation maven eclipse

Here Insert Picture Description

Published 108 original articles · won praise 29 · views 110 000 +

Guess you like

Origin blog.csdn.net/Gabriel_wei/article/details/99670497