我想设置我的构建,以便它自动尝试从 Maven Central 下载工件,前提是我们的 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 非常稳定,永远不会宕机。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)