Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Graphic and text tutorial of maven installation and configuration under Windows (including localized warehouse configuration)

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Download maven

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

Download is a compressed file, unzipped. What I downloaded is version 3.5.2. After decompression, it is as follows:

The path is: d:\ Program Files\ apache-maven-3.5.2

Second, configure environment variables

Add a custom variable: MAVEN_HOME

The value is the decompression path just now: d:\ Program Files\ apache-maven-3.5.2.

MAVEN_OPTS =-Xms128m-Xmx512m (optional)

Add ";% MAVEN_HOME%\ bin;" at the end of the path variable.

Third, verify whether the installation is successful

Open the command line and enter: mvn-v. If the relevant information about maven appears, the installation is successful.

4. Configure the local warehouse

The most direct benefit of using Maven is the unified management of jar packages, so where are these jar packages stored? They are in your local repository, and the default address is located in the C:\ Users\ username. M2 directory (you can also modify this default address, of course). Let's modify this default address.

In fact, we can understand the "cache" of the local repository for the purpose of storing jar packages. When developing a project, the project will first obtain the jar package from the local warehouse, and when the specified jar package cannot be obtained, the local warehouse will download the jar package from the remote warehouse (or central warehouse) and "cache" it to the local warehouse for future use.

The remote warehouse (central warehouse) is officially provided by Maven and can be accessed through http://search.maven.org/. As a result, the local warehouse will grow as the project accumulates. The relationship between the project, the local warehouse, and the remote warehouse can be clearly expressed in the following diagram.

Now that Maven is installed, there is a local repository, and the default path is in our C disk directory. But disk c is always dangerous, so how to change this default configuration?

Open the maven installation directory\ conf\ setting.xml file.

E:\ Maven_Repo...

Then the default local warehouse location has been changed to the E:\ Maven_Repo directory.

It is best to create the directory manually first.

5. Check whether the settings just now are effective.

Command line input: mvn help:system

If there is no problem, the configuration has been successful. Now if we go to the E:\ Maven_Repo directory, we will find that there are already a lot of files in that directory. These are the files maven downloaded from the central warehouse.

Summary

The above is the graphic and text tutorial of maven installation and configuration under Windows (including localized warehouse configuration) introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report