Maven Mirroring Configuration

Source: Internet
Author: User

Reference: Xu Xiaobin's "maven combat"

Mirroring is designed to provide faster service


X is considered to be a mirror of Y.

Edit Settings.xml Configure the Central warehouse Image:

[HTML]View Plaincopyprint?
  1. <settings>
  2. ...
  3. <mirrors>
  4. <mirror>
  5. <ID>maven.net.cn</ID>
  6. < name >one of the central mirrors in China</name>
  7. <URL>http://maven.net.cn/content/groups/public/</url>
  8. <mirrorof>central</mirrorof>
  9. </Mirror>
  10. </Mirrors>
  11. ...
  12. </Settings>


<mirrorof> is central, which indicates that this configuration is a mirrored , Any request for a central warehouse will be transferred to the mirror

Any required artifacts can be obtained from a single database, which is the mirror of all warehouses. At this point, you can configure a mirror such as the example:

[HTML]View Plaincopyprint?
  1. <settings>
  2. ...
  3. <mirrors>
  4. <mirror>
  5. <ID>internal-repository</ID>
  6. <name>internal Repository Manager</name>
  7. <URL>http://192.168.1.100/maven2</url>
  8. <mirrorof>*</mirrorof>
  9. </Mirror>
  10. </Mirrors>
  11. ...
  12. </Settings>


In this example , the value of <mirrorOf> is an asterisk, which means that the configuration is a mirror image of all maven warehouses, and any requests for remote warehouses will be forwarded to http://192.168.1.100/maven2/. If the mirror warehouse requires authentication, configure an <server> with an ID of internal-repository. To meet a number of complex requirements, MAVEN also supports more advanced mirroring configurations:

1.<mirrorOf>*</mirrorOf>

Matches all remote warehouses.

2.<mirrorOf>external:*</mirrorOf>

Match all remote warehouses except with localhost, except with the FILE://protocol. That is, match all remote warehouses that are not on this computer.

3.<mirrorof>repo1,repo2</mirrorof>

Match warehouses Repo1 and REPO2, separating multiple remote warehouses with commas.

4.<mirrorOf>*,!repo1</miiroOf>

Match all remote warehouses except REPO1, using an exclamation point to exclude the warehouse from the match.

It is important to note that because the mirrored warehouse is completely shielded from the mirrored warehouse, MAVEN will not be able to download artifacts when the mirrored warehouse is unstable or the service is stopped.

Maven Mirroring Configuration

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.