Analysis of the difference between mirror and repository

Internal repository refers to the repository built inside the LAN. It differs from the central repository, jboss repository, etc. only in that its URL is an internal URL.
Mirror is equivalent to a proxy, it intercepts the request to the specified remote repository download component, and then finds the component back to the client from itself. The purpose of configuring the mirror is generally to consider the speed of the network.
It can be seen that the internal repository and the mirror are two different things. The former is a repository itself, and can be used to provide services along with other repositories. For example, it can be used to provide maven components inside the company; the latter is not a repository itself, it is just a network accelerator for remote repositories.

However, many internal repository build tools often also provide mirror services. For example, Nexus can make the same URL, both as an internal repository and make it a mirror for all repositories.

If repository X can provide all the content stored in repository Y, then X can be considered a mirror of Y. In other words, any component that can be obtained from repository Y is available from its image. For example, the central warehouse is mirrored in China. Due to geographical location, the image can often provide faster services than the central warehouse. Therefore, you can configure Maven to use this image instead of the central repository. Edit setTIngs.xml, the code is as follows:

...
Maven.net.cn
One of the central mirrors in china
Http://maven.net.cn/content/groups/public/
Central
...

In this example, the value is central, indicating that the configuration is a mirror of the central repository. Any requests to the central repository will be transferred to the image. Users can also configure mirroring of other warehouses in the same way. The other three elements id, name, and url are the same as the general warehouse configuration, indicating the unique identifier, name, and address of the mirror repository. Similarly, if the image requires authentication, the warehouse authentication can also be configured based on the id.
A more common use of mirroring is to combine private services. Since the private service can proxy any external public repository (including the central repository), for a Maven user inside the organization, using a private service address is equivalent to using all the external warehouses needed, which can simplify the configuration to the private service, thus simplifying The configuration of Maven itself. In this case, any required components can be obtained from the private service, which is a mirror image of all the warehouses. At this point, you can configure such a mirror, as in the example:

...
Internal-repository
Internal Repository Manager
Http://192.168.1.100/maven2
*
...

The value in this example is an asterisk, indicating that the configuration is a mirror of all Maven repositories, and any requests to the remote repository will be forwarded. If the mirror repository requires authentication, configure an Id for internal-repository. To meet some of the complex requirements, Maven also supports more advanced mirroring configurations:
1.*
Match all remote repositories.
2.external:*
Match all remote repositories, except for using localhost, except for the file:// protocol. In other words, match all remote repositories that are not on the machine.
3.repo1, repo2
Match the repo1 and repo2 repositories, separating multiple remote repositories with commas.
4.*,!repo1
Match all remote repositories, except for repo1, which excludes the repository from the match with an exclamation point.

It should be noted that since the mirrored repository completely shields the mirrored repository, when the mirrored repository is unstable or stops serving, Maven will still be unable to access the mirrored repository and will not be able to download the artifacts.

Maven: mirror (mirror) and repository (warehouse) difference

Wireless Bluetooth Keyboard

Wireless Bluetooth Keyboard,Best Wireless Gaming Keyboard,Bluetooth Keyboard,Keyboard Bluetooth Dual-Mode Connection

Guangzhou Lufeng Electronic Technology Co. , Ltd. , https://www.lufengelectronics.com

This entry was posted in on