Detailed Maven installation tutorial

Original link: https://www.cnblogs.com/yyiou/archive/2017/08/22/7411409.html

1. Preparation

               1. Make sure that jdk7.0 or above has been successfully installed on the computer

                2, win10 operating system

                3. Maven installation package Download address: http://maven.apache.org/download.cgi

2. Unzip the Maven installation package

                Download the latest Maven version from the above address, extract it to the specified directory (here according to your own needs), I extracted it to the D:\install\maven\apache-maven-3.5.0 directory, which contains bin, lib
               
                conf, etc. folder.

3. Configure Maven environment variables

              In My Computer-------Properties-------Advanced System Settings---------Environment Variables---------System Variables------ --new

                Variable name: M2_HOME

                Variable value: D:\install\maven\apache-maven-3.5.0

          Find the Path and add it at the end of the environment variable value: ;%M2_HOME%\bin; //Pay attention to the semicolon before  

Fourth, check whether the environment variables of jdk and maven are configured successfully

      Open the dos window and run the command mvn -v, the information shown in the following figure appears, indicating that the installation is successful;

 

5. Modify the local warehouse location ( if you do not want to modify the local warehouse location, this step can be omitted )

      Maven will place the downloaded class library (jar package) in a local directory (by default, maven's local repository is located in C:\My Documents\.m2.\repository ), if you want to redefine this The location of the directory needs to modify the configuration of the Maven local warehouse:

             1. Create a folder in your favorite location, the location I created here is (F:\Maven\repo)

             2. Find the conf folder in the directory where Maven is installed, find the settings.xml file in the folder, copy the settings.xml file and put it in F:\Maven , as shown in the following figure:

             3. Modify the settings.xml file as shown below:

             4. Find the conf folder in the directory where Maven is installed, find the settings.xml file in the folder, and change the default warehouse location as shown below: (note that the settings.xml in both places must be modified)

    According to this configuration, Maven will save the downloaded class library to F:/Maven/repo.

    5. Experiment to see if what we just did has any effect, console input: mvn help:system

 

     After executing this command, there will be many files under F:/Maven/repo. These files are the files downloaded by maven from the central repository to the local repository.

 

 

References; http://www.cnblogs.com/leefreeman/archive/2013/03/05/2944519.html


Guess you like

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