gpt4 book ai didi

maven - 如果 Nexus 服务器关闭,如何配置 Maven 访问 Maven Central?

转载 作者:行者123 更新时间:2023-12-02 00:27:36 25 4
gpt4 key购买 nike

我想设置我的构建,以便它自动尝试从 Maven Central 下载 Artifact ,前提是我们的 Nexus 服务器无法访问。我在 settings.xml 中有以下内容,但我不知道如何更改它(如果可能的话)。

<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<repositories>
<repository>
<id>central</id>
<url>http://mynexus</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://mynexus</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>

<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>

最佳答案

为了使用存储库管理器(包括Nexus),您需要定义一个mirrorOf*元素,该元素将拦截所有存储库URL并将它们发送到Nexus进行解析。在Maven2和3中,无法在配置文件中配置mirrorOf元素。这意味着没有简单的方法可以在不更改设置的情况下来回翻转。

您需要注释掉镜像部分,然后停用 Nexus 配置文件以使 Maven 恢复为标准行为。

幸运的是,Nexus 非常稳定,它永远不会崩溃。

关于maven - 如果 Nexus 服务器关闭,如何配置 Maven 访问 Maven Central?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6541002/

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