<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>
</mirrors>
項目中pom.xml配置了客戶的私服,如下:
<distributionManagement>
<repository>
<id>bank_central</id>
<name>core Release Repository</name>
<url>http://......:9090/repository/bank_central/</url>
</repository>
<snapshotRepository>
<id>bank_privrepository_snapshots</id>
<name>core Snapshots Repository</name>
<url>http://......:9090/repository/bank_privrepository_snapshots/</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<id>bank_privrepository_interfaces</id>
<name>bank_privrepository_interfaces</name>
<url>http://......:9090/repository/bank_privrepository_interfaces/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>bank_privrepository_snapshots</id>
<name>bank_privrepository_snapshots</name>
<url>http://......:9090/repository/bank_privrepository_snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<!--中央倉庫,插件安裝 -->
<id>nexus</id>
<name>local nexus server</name>
<url>http://......:9090/repository/bank_central/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
經歷了反覆的clean-build、maven force update及各種可能想得到的操作,某些依賴包依然無法下載。
後來突發奇想,將settings.xml中
<mirrors/>
配置項刪除,重新force update,某些包可以下載下來了,但依然缺包,後來查閱各種資料,將setting.xml中*改爲central
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>central</mirrorOf>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>
</mirrors>
perfect!!!!!!!!!!!!!!!知其然不知其所以然,待更新
官方說明:https://maven.apache.org/guides/mini/guide-mirror-settings.html
*的意思就是(根據mirrorOf和repository的id)匹配所有的庫(repository),這樣就是說如果你需要某個jar,他會從鏡像地址去下載這個jar。不管你配置了多少個庫,即使這些庫的地址不一樣,仍然會從鏡像地址訪問