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.