The Spring framework provides a comprehensive programming and configuration model for modern Java-based enterprise applications on any type of deployment platform. The biggest characteristic of modern enterprise applications is the large volume, so we need to install a management and build tool when we use Spring to develop, organize files and import dependency libraries for us, greatly reducing the difficulty of our development.

Maven is just such a tool, so installing Maven before learning about the SpringFramework will make us less productive!

Download Maven

Installation address. Select the apache maven – 3.3.9 – bin. Zip. If you need another version, click Parent Directory.

Decompress the Maven package

Once downloaded, it is recommended to create a new Maven folder and unzip the package to get apache-Maven-3.3.9. The next step is to configure environment variables.

Configure maven environment variables

After installation, you need to configure the system environment, right click on the computer, click properties, the rest of the operation as shown in the picture below:

1. Create MAVEN_HOME

The variable name is MAVEN_HOME and the value is

C: \ other \ develop \ Maven \ apache Maven — 3.3.9

Of course, this is a custom, as long as you find the decompressed file storage can be.

Then click OK.

2. Edit the system variable Path

Click New and fill in

%MAVEN_HOME%\bin

Notice that there is no semicolon in front of it. If there is a semicolon, there are other environment variables in front of it.

3. Set the MAVEN_OPTS environment variable (optional)

Variable name: MAVEN_OPTS, variable value:

-Xms128m -Xmx512m

Setting the MAVEN_OPTS environment variable is not required, but is recommended. Because Java the default maximum available memory are often not able to meet the needs of Maven to run, for example in the project is bigger, use Maven generating project site needs to take up a lot of memory, without the configuration, it’s easy to get Java. Lang. OutOfMemeoryError. Therefore, it is recommended to configure this variable initially.

Check whether the installation is successful

Finally, check whether the configuration is successful: use win key +R to open the command line prompt window, and enter MVN –version. If the following situation occurs, the configuration is successful.

Modifying a Configuration File

Now create a new repository file under the Maven file. Then open the maven under the conf folder Settings. The XML file, find the localRepository nodes, configure the local Repository path, I here configuration is: C: / other/develop/maven Repository.

<localRepository>C:/other/develop/Maven/repository</localRepository>
Copy the code

Note: the path in the file is not the same as the path under Windows. After copying it, replace \ with/and do not include Chinese.

Now that the configuration is successful, let’s start our SpringFramework learning tour!

This article is part of the “Gold Nuggets For Free!” Event, click to view details of the event