因為maven默認是在http://my.repository.com/repo/path下載鏡像包,外網一般下載比較慢,所以我們需要使用國內鏡像地址進行加快下載速度
在maven安裝路徑,以我的地址路徑為示例:C:\Program Files\Java\apache-maven-3.6.3-bin\apache-maven-3.6.3
在該文件夾的conf文件夾路徑下有個settings.xml文件
修改原有的鏡像
<mirrors> <!-- mirror | Specifies a repository mirror site to use instead of a given repository. The repository that | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used | for inheritance and direct lookup purposes, and must be unique across the set of mirrors. | <mirror> <id>mirrorId</id> <mirrorOf>repositoryId</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://my.repository.com/repo/path</url> </mirror> --> </mirrors>
為
<mirrors> <!--阿里雲鏡像--> <mirror> <id>nexus-aliyun</id> <mirrorOf>*</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror> </mirrors>
