Uninstallation, reinstallation and configuration of super detailed maven

Posted by azylka on Thu, 17 Feb 2022 06:09:50 +0100

For image download, domain name resolution and time synchronization, please click Alibaba open source mirror station

1, maven uninstall

maven only configures the environment variable and local warehouse when it is used. We only need to delete the local warehouse and remove maven's environment variable from the environment variable.

1. Delete the extracted maven folder;

In the previous installation, I put the files extracted from the local warehouse and maven in the same folder.

Delete the Maven folder

2. Delete the set environment variable Maven_ Home, delete "% MAVEN_HOME%\bin;" added in path;

Delete% Maven in Path_ HOME%\bin;

All points in the back window: OK!!! (otherwise, it may not take effect and the deletion is unsuccessful)

3. Delete local warehouse;

In the first step, we have deleted the local warehouse. We can delete it according to the location of the local warehouse configured before. If there is no configuration, it is in C: \ users \ administrator by default M2 \ repository path, delete the folder named: repository.

Delete repository

So far, maven has been deleted successfully!!! Next, start the reinstallation and configuration of maven.

2, maven Download

1. Enter the official website to download: Download from maven official website

2. Scroll down to find Download. If you need the latest version, select apache-maven-3.8.4-bin Zip Click to Download.

(for stability reasons, it is not recommended to download the latest version. If you choose to download the latest version, you can click to wait for the download to complete, and you won't see the following small steps.)

(if you need to download other versions, continue to see the following small steps)

① Scroll down to find the following interface and click archives

② Scroll down to find the version you want to download and click

③ Click: binaries/

④ Click: apache-maven-3.8.1-bin Zip and wait for the download to complete.

3, Configure maven environment variables

1. Unzip it to the specified folder. The completion of unzip is as follows:

2. Configure environment variables

① This computer - > properties - > advanced system settings - > environment variables

② Select the system variable and click new

③ Enter variable name and value variable name: maven_ Home variable value: D:\Environment\maven-3.8.1\apache-maven-3.8.1 (the variable name is MAVEN_HOME, and the variable value is the installation path, which is the path in the first step)

④ Configure Path, double-click to open Path - > New

⑤ Input:% MAVEN_HOME%\bin

3. Test whether the environment variable configuration is successful

① Open cmd as Administrator

② Input: mvn -v

If the version information of maven appears, the configuration is successful. If not, carefully check whether the above environment variables are configured correctly.

4, Configure maven local warehouse

1. Create a folder named myRepository under maven's installation directory.

2. Modify settings XML configuration file, located in the \ conf directory.

① Use Notepad to open settings XML, replace all the information in the file with the following, and exit after saving:

(Note: the path in the middle of D:/Environment/maven-3.8.1/myRepository is the location of the previously created local warehouse, which is changed to its own warehouse location according to the actual situation, and the separator of the path is changed to /)

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <!-- <localRepository>/Users/Fred/Downloads/apache-maven-3.5.4/repository</localRepository> -->




        <name>aliyun maven</name>

    <!-- Image of central warehouse in China -->
      <name>one of the central mirrors in china</name>
    <!-- Central warehouse 1 -->
        <name>Human Readable Name for this Mirror.</name>


Remember to save after modification, and then exit!!!

3. Open cmd and execute: mvn help:system

At this time, the local warehouse will download the required files from the central warehouse.

The download process will vary according to the network speed. Just wait patiently until BUILD SUCCESS appears, which proves that the download is complete!!!

Open the local warehouse to view. Some files have been downloaded.

This article is transferred from: https://blog.csdn.net/weixin_46081857/article/details/121719684

Topics: Apache JDK Maven Spring .NET