Using mirrorOf instead of changing repository URLs

To point to a repository manager, you might need to change each and every repository defined in your application POM file or the settings.xml file. Instead of changing the repository itself, it is recommended to use a mirror.

For example, you might already have a repository under the central ID, as shown in the following code:

<repository>
  <snapshots>
    <enabled>false</enabled>
  </snapshots>
  <id>central</id>
  <name>Central Repository</name>
  <url>http://repo.maven.apache.org/maven2</url>
</repository>

Instead of changing the url tag of the preceeding configuration, you can define a mirror as shown in the following code. As the value of the mirrorOf element is set to *, any of the repositories defined in the system (or in any application POM file) will use the following mirror repository:

<mirrors>
  <mirror>
    <id>packt-group</id>
    <name>PACKT Nexus Group Repository</name>
    <url>http://localhost:8081/nexus/content/groups/packt-group/</url>
    <mirrorOf>*</mirrorOf>
  </mirror>
</mirrors>
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.157.197