gpt4 book ai didi

maven - 使用单个存储库和单个镜像的区别

转载 作者:行者123 更新时间:2023-12-04 23:56:11 25 4
gpt4 key购买 nike

Maven 文档说:

http://maven.apache.org/guides/mini/guide-mirror-settings.html

Using A Single Repository. You can force Maven to use a single repository by having it mirror all repository requests. The repository must contain all of the desired artifacts, or be able to proxy the requests to other repositories. This setting is most useful when using an internal company repository with the Maven Repository Manager to proxy external requests.

To achieve this, set mirrorOf to *.


<settings>
...
<mirrors>
<mirror>
<id>internal-repository</id>
<name>Maven Repository Manager running on repo.mycompany.com</name>
<url>http://repo.mycompany.com/proxy</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
...
</settings>

我不明白这一段。

不应该是这样的吗?

Using A Single Mirror You can force Maven to use a single mirror by having it mirror all repository requests. The mirror must contain all of the desired artifacts for all the repositories, or be able to proxy the requests to other repositories. This setting is most useful when using an internal company repository with the Maven Repository Manager to proxy external requests. To achieve this, set mirrorOf to *.


 <settings>
...
<mirrors>
<mirror>
<id>internal-mirror</id>
<name>Maven Mirror Manager running on mirror.mycompany.com</name>
<url>http://mirror.mycompany.com/proxy</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
...
</settings>

我的误会在哪里?

我的意思是, <mirror><id>internal-repository</id>...对我来说似乎是错误的。

最佳答案

镜像是指用作其他存储库的传递者/代理的存储库。
当使用像 Nexus、Artiafactory、Archiva 这样的存储库管理器时,你处理了一个本地企业存储库,它代表远程存储库。
所以不需要在你的 pom 或 setting.xml 中声明太多的仓库。仅使用一个将所有请求重定向到您拥有的存储库管理器的镜像就足够了。
这就是文档的含义。

关于maven - 使用单个存储库和单个镜像的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16063213/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com