Local warehouses refer to warehouses that exist in our local machine. When we join the dependency, we will first go to our local warehouse to search. If we cannot find them, we will go to the remote warehouse to search. For dependent packages, you can search from this address: http://mvnrepository.com/.
Remote warehouse refers to warehouses on other servers, including global central warehouses, private servers within the company, or public libraries provided by other companies. I will talk about private servers later. The public database is just an address, and everyone can just quote it.
Maven's local repository is used to store all project dependencies (plug-in jars and other files that are downloaded by Maven) to the local folder. It's very simple, when you create a Maven project, all relevant files will be stored in your Maven local repository.
After adding the maven2 plug-in from eclipse, the default local library path of maven is ${user}/.m2/repository/. Generally, Windows users' operating systems are installed on the C drive, so the jar packages in this directory are more dangerous. I tried to find the M2_REPO variable from myeclipse->preferences->java->build path->classpath variables, and found that its path points to "C:/Documents and Settings/lvxda.m2/repository/". I want to modify its path to: d:/m2/repository, but the edit button of this variable is gray and cannot be edited. No corresponding solution was found online. Planning to try it yourself:
1. The address of the local repository is: d:/m2/repository
Added from the windows environment variable: M2_REPO=d:/m2/repository, and add this variable to the path variable.
Modify the d:/maven/conf/setting.xml file and add a new line under the node:
<localRepository>d:/m2/repository</localRepository>
The address of the local repository is: d:/m2/repository
Add a maven that has been installed on the d disk under myeclipse->preferences->maven->installations, such as: d:/maven, and check this new add-on. And click the browser button below to open the global configuration file of maven, such as: d:/maven/conf/setting.xml.
Modify the user setting option from myeclipse->preferences->maven->installations to: D:/m2/repository/settings.xml, and click update settings. And click the reindex button below to update the index.
Click the apply button of the configuration window to highlight the configuration window.
After the configuration is modified, myeclise will automatically update the index. When myeclipse is completed, you will find that the value of the M2_REPO variable has become d:/m2/repository.
From then on, the jar packages downloaded by maven from the remote library will be placed under d:/m2/repository. In order to avoid downloading jars from the remote repository every time the system is built, a private server is needed.
Personal operation method:
1. The address of the local repository manually is: d:/maven/m2/repository
2. At the person who has installed it, copy a copy of settings.xml, or it can also be the xml carried by maven installed by yourself.
3. Open settings.xml, find, modify the value to d:/maven/m2/repository, and save
4. Open eclipse, Windows>Maven>User Settings, and browse the settings.xml file location from copy under User Settings
5. Click Update Settings, and the repository address in Local Repository will be modified to d:/maven/m2/repository
6. Click the reindex button on the right to update the index, and maven will automatically update the jar package online to the local machine.
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.