Maven local repository Configuration

Source: Internet
Author: User

I. Why?

By default, the maven local repository is in the directory. m2/repository under drive C. All Maven components (artifact) are stored in this repository for reuse.

However, disk C occupies space and is not secure. in case of system reinstallation, this article introduces how to modify the local repository path of Maven.


2. configuration steps:

1. manually create a storage path for the local repository, for example, G: \ m2 \ repository;

2. added the new system variable m2_repository in the Windows environment variable. Its value is G: \ m2 \ repository (Local Storage path of Maven repository ),

Add this variable to the PATH variable: % m2_repository %;

3. Modify the setting. xml file in the conf/folder under the maven installation directory,

Add a new row: <localrepository> G: \ m2 \ repository </localrepository> (the address of the local repository is: G: \ Java \ m2 \ repository );

4. Copy the setting. xml file modified in step 3 to the G: \ m2 \ repository directory;

3. Configure Eclipse:
1. Open eclipse and click windows-> preferences-> Maven-> installations to add a Maven that has been installed in the G: \ Java directory, such as: G: \ Java \ maven-3.0.4,

Select this add item. And click the following Browse button to open the maven global configuration file, such as: G: \ Java \ maven-3.0.4 \ conf \ setting. xml.

2. Open myeclipse and click Windows> preferences> Maven> user setting to change the user setting option to G: \ Java \ m2 \ repository \ Settings. xml,

Click the Apply button below to apply the settings.
3. open command line CMD and execute MVN help: system. MAVEN will save the jar package downloaded from the remote database to the new path G: \ Java \ m2 \ repository.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.