Windows installation maven (InsCode AI creation assistant)

Before installing maven, make sure that jdk has been installed. The jdk installation version this time is 1.8.

1. Download

Download location:https://maven.apache.org/download.cgi

In the provided information, the downloaded installation package has been provided. as follows:

Insert image description here

2. Installation steps

Maven installation and configuration steps:

  1. Unzip and install
  2. Configure warehouse
  3. Configure Maven environment variables

1. Unzip apache-maven-3.6.1-bin.zip (unzip and install)

It is recommended to decompress to a path without Chinese or special characters. For example, unzip it to E:\develop in the course.
Insert image description here

The unzipped directory structure is as follows:
Insert image description here

  • bin directory: stores executable commands. (Focus on the mvn command)
  • conf directory: stores Maven configuration files. (The settings.xml configuration file needs to be modified later)
  • lib directory: stores jar packages that Maven depends on. (Maven is also developed using Java, so it also depends on other jar packages)

2. Configure the local warehouse

2.1. Create a new directory on your computer (local warehouse, used to store jar packages)
Insert image description here

2.2. Enter the conf directory and modify the settings.xml configuration file.

1). Use Super Notepad software to open the settings.xml file and locate line 53.

2). Copy the label and paste it outside the comment (line 55)

3). Copy the previously created path to store the jar package and replace the tag body content.
Insert image description here

3. Configure Alibaba Cloud private server

Since the central warehouse is abroad, downloading jar packages may be slow. Alibaba provides a remote warehouse, which basically contains jar packages for open source projects.

Enter the conf directory and modify the settings.xml configuration file:

1). Use Super Notepad software to open the settings.xml file and locate around line 160.

2). Add sub-tags under the tag with the following content:

<mirror>  
    <id>alimaven</id>  
    <name>aliyun maven</name>  
    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    <mirrorOf>central</mirrorOf>          
</mirror>

Pay attention to the location of the configuration and add the configuration in the middle of .... As shown below:

Insert image description here

4. Configure environment variables

The configuration of Maven environment variables is similar to the configuration of JDK environment variables.

1). Create a new variable MAVEN_HOME in the system variable

  • The value of the MAVEN_HOME environment variable is set to the maven decompression installation directory.

2). Configure in Path

  • The value of the PATH environment variable is set to: %MAVEN_HOME%\bin

Insert image description here

3). Open the DOS command prompt for verification. If the message shown in the figure appears, the installation is successful.

mvn -v

Insert image description here

Guess you like

Origin blog.csdn.net/LSW1737554365/article/details/134558756