maven仓库拉取nexus的仓库组的规则是什么呢?如果配了多个代理仓库,是如何工作的?
打开nexus的管理员文档:https://help.sonatype.com/repomanager3/nexus-repository-administration/repository-management
Note that the order of the repositories listed in the Member section is important. When the repository manager searches for a component in a repository group, it will return the first match. To reorder a repository in this list, click and the drag the repositories and groups in the Members list or use the arrow buttons between the Available and Members list. These arrows can be used to add and remove repositories as well.
核心就一句话,它会一个一个仓库找哪个仓库有这个组件的信息,如果找到了,就不会再往下找了。
The order of repositories or other groups in a group can be used to influence the effective metadata that will be retrieved from a repository group. It is recommended practice to place hosted repositories higher in the list than proxy repositories. For proxy repositories, the repository manager may need to check the remote repository which will incur more overhead than a hosted repository lookup.
把host类型的仓库放代理仓库前面,可以更快。
It is also recommended to place repositories with a higher probability of matching the majority of components higher in this list. If most of your components are going to be retrieved from the Central Repository, putting maven-central higher in this list than a smaller, more focused repository is going to be better for performance, as the repository manager is not going to interrogate the smaller remote repository for as many missing components. These best practices are implemented in the default configuration.
把有大多数jar的仓库放前面,最好把maven中央仓库(国内就最好把ali镜像)放前面。