[Go] Modify MAVEN local warehouse path

Source: Internet
Author: User

After adding the Maven2 plugin from Eclipse, the path to MAVEN's default local library is ${user}/.m2/repository/ , and the general Windows user's operating system is installed on the C drive. So the jar package under this directory is more dangerous. I tried to find the M2_repo variable from the myeclipse->preferences->java->build path->classpath variables , and found that its path pointed to the "C:\Documents and Settings\lvxda\.m2\repository\", I want to modify its path to:d:\m2\repository, but this variable's edit button is gray, Not editable. No corresponding solution has been found on the Internet. To try it yourself:

1, manually create the local warehouse address is:d:/m2/repository

2, added from the environment variable of Windows:m2_repo=d:\m2\repository, add this variable to the path variable at the same time.

3, modify the d:\maven\conf\setting.xml file, add a line under the <localRepository> node:

Copy the contents to the Clipboard,

Code:<localRepository>d:/m2/repository</localRepository>

Represents the address of the local warehouse:d:/m2/repository

4. From myeclipse->preferences->maven->installations add a maven already installed to the D drive, such as:D:\maven, And tick this new add-on. and click on the browse button below to open MAVEN's global profile, such as:d:\maven\conf\setting.xml.

5. Modify the user setting option from myeclipse->preferences->maven->installations to:D:\m2\repository\ Settings.xml, and click Update Settings. and click on the Reindex button below to update the index.

6. Click the Apply button in the Configuration window to highlight the configuration window.

7, configuration changes, Myeclise will automatically update the index, when the completion of the restart MyEclipse, you will find the value of M2_repo variable becomes d:/m2/repository.

Since then, the jar packages that Maven downloads from the remote library will be placed under d:/m2/repository . To avoid downloading jars from a remote repository every time the build system is built, you need to set up a.

[Go] Modify MAVEN local warehouse path

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.