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> ...