Maven development environment construction

premise 

 

Before building the Maven development environment, we must have two prerequisites:

  • 1. Our computer has installed and configured jdk;

  • 2. Because Maven often needs to download various required files through the network when working, we need to ensure that the network is normal.

Maven installation and configuration

1. Download Maven

We can directly visit Maven's official website to download Maven:

 maven official website: http://maven.apache.org

*Note we need to download the binary .zip file

2. Install Maven

2.1 Decompression

   After the download is complete, we can directly decompress the .zip file (note that the file should be decompressed to the directory we need)

2.2 Configure environment variables

   The steps here are the same as configuring jdk. We need to right-click this computer, click properties, open advanced settings, click environment variables, find the path variable in the system environment variables, click new, find the bin directory in the address we decompressed, And add it to the new environment variable, and then click OK.

After the configuration is complete, we can check whether the configuration is correct through the command line command. We only need to open cmd (that is, the command prompt) in the computer and enter the command: ​mvn

If the configuration information shown in the figure is displayed, the configuration is successful

2.3 Configure warehouse address

Here we need to find our decompressed file, find the settings.xml file under the conf folder and open it to modify as follows:

2.3.1 First we need to configure the local warehouse address:

We need to find the localRepository label, release it, and put the local warehouse address directory we created in advance

2.3.2 Next, we configure a third-party mirror warehouse address

   Here we configure a mirror address of Ali. Similarly, we need to find the mirrors tag in the settings.xml file and release it. We only need to paste the following code into it and save it to complete the configuration

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

That is, as shown in the figure below:

3. Configure Maven in idea

3.1 Replace Mave n bundled with idea

The specific operation is shown in the figure:

3.1.1. Open Settings for New Projects
 

3.1.2 Replacement

3.2 Create a Maven project

At this point, the construction and configuration of our Maven development environment is completely completed!!! 

Guess you like

Origin blog.csdn.net/weixin_52629592/article/details/125842755