Apache Maven (vi): Repository

Source: Internet
Author: User
Tags jfrog artifactory maven central sonatype nexus

The Maven repository is primarily for storing some third-party dependent jar packages.

Strictly speaking, there are only two repositories: local and remote, the local repository is a cache that you remotely download to local, and also contains temporary build files that have not yet been published. Remote repositories refer to remote repositories that can be downloaded through various protocols such as FILE://or http:///and (for example, the MAVEN central repository in repo.maven.apache.org and uk.maven.org). Other "remote" repositories may be internal repositories set up on files or HTTP servers within a company, to share private artifacts between development teams and publications, or to be called server.

Internal repositories

Internal repositories can also be referred to as private networks, where connection to Internet downloads is not guaranteed for security, speed, or bandwidth, especially in an enterprise environment, using MAVEN. For this reason, it's a good idea to set up an internal repository (private) to hold a copy of the artifact and publish a dedicated artifact.

This internal repository can be downloaded using HTTP or a file system (using File://url) and uploaded to the use of scp,ftp or a copy of the file.

Set up internal repositories

Setting up the internal repository requires only that you have a location to place it and replicate the required artifacts in the same layout as the remote repository (for example: repo.maven.apache.org).

It is not recommended that you use rsync://to replicate the full library of the central repository, it is recommended that you use a resource Management Server (e.g. Sonatype Nexus OSS, Jfrog artifactory Open source, Apache Archiva and other open source projects), The artifacts are then saved in the internal repository for quick download later.

Using the internal repository

Using an internal repository is very simple, just add the repositories tag to the Pom, as shown here:

1 <Project>2   ...3   <repositories>4     <Repository>5       <ID>My-internal-site</ID>6       <URL>Http://myserver/repo</URL>7     </Repository>8   </repositories>9   ...Ten </Project>

If your internal repository requires authentication, you need to use an ID in your settings file to specify the login information.

Local repositories

Usually I need to deploy my project to a local repository for sharing, and other projects can access the project directly, simply by doing the following:

MVN Install

This command can be used to package local items into the local repository.

Remote repositories

If you want to deploy a local project to a remote repository, this refers to the following command:

MVN Deploy

Apache Maven (vi): Repository

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.