MAVEN's Local warehouse repository

Source: Internet
Author: User
Tags maven central

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

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.