MAVEN uses a centralized approach to managing jar packages, where a Java project built with MAVEN can reuse a managed jar package, so there must be a uniform repository of jar files, which is the jar repository, which will create a local repository for both development and deployment.
When the project compiles, it will find out if the local repository contains the corresponding jar package based on the dependencies configured in the Pom.xml file, and if it is not, it will be downloaded from the MAVEN central repository, and we can copy the Jar warehouse from other computers when we build the MAVEN environment, avoiding the time wasted by repeated downloads.
Central repository Configuration: There is a maven-model-builder jar package in the Maven Lib folder, open with compression software, in org\apache\maven\ The model has a file named Pom-4.0.0.xml, the file can be opened to see the following configuration,
<repositories>
<repository>
<id>central</id>
<name>central Repository </name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</ layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</ Repository>
</repositories>
Where the URL is the central warehouse address, copied to the browser open, we see all the jar package.
You can also use the install command to put the developed modules into the local repository for other modules to call, so that multiple teams to sub-module development projects.
The location of this warehouse is X:\Documents and settings\administrator.lipeng.m2\repository (x is the drive letter of your operating system), and you can change the default location by modifying the configuration file. The configuration file is under the Conf subdirectory under the MAVEN directory. The file is called Settings.xml. Add the following node information in the configuration file to F:/repository.
<localRepository>F:/Repository</localRepository>
Take JUnit, for example, to analyze Pom.xml and the local warehouse structure.
Configuration in the Pom.xml
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId> junit</artifactid>
<version>3.8.1</version>
</dependency>
</ Dependencies>
Files in the Local warehouse
Repository
--JUnit
|--JUnit
|–3.8.1
| ' –junit-3.8.1.jar