Maven Intranet存储库故障转移重定向 [英] maven intranet repository fail-over redirect

查看:88
本文介绍了Maven Intranet存储库故障转移重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将"Artifactory"设置为Intranet Maven存储库.我有关于故障转移的问题.

I have setup 'Artifactory' as intranet maven repository. I have question related to fail-over.

项目POM

    <repositories>
    <repository>
        <id>central</id>
        <url>http://mvn.mycompany.com:8081/artifactory/libs-release</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>snapshots</id>
        <url>http://mvn.mycompany.com:8081/artifactory/libs-snapshot</url>
        <releases>
            <enabled>false</enabled>
        </releases>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>central</id>
        <url>http://mvn.mycompany.com:8081/artifactory/plugins-release</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </pluginRepository>
    <pluginRepository>
        <id>snapshots</id>
        <url>http://mvn.mycompany.com:8081/artifactory/plugins-snapshot</url>
        <releases>
            <enabled>false</enabled>
        </releases>
    </pluginRepository>
</pluginRepositories>   

问题: 是否可以使用故障转移存储库?意思是..如果我的Intranet信息库已关闭,那么Maven构建应该自动使用其他位置或直接从Maven Central使用??

QUESTION: Is it possible to use fail-over repository? meaning.. if my intranet repository is down, then maven build should automatically use some other location or directly from maven central??

推荐答案

我不确定您为什么会认为存储库将关闭,但是退回到Maven Central并不是一个好主意.您会失去使用公司存储库的所有好处,甚至根本不知道它,因为无法确定构建从何处获取依赖关系.

I am not sure why you expect your repository to be down, but falling back to maven central is a really bad idea. You loose all the benefits of using corporate repository, and don't even know about it, because there is no way to determine where your build took dependencies from.

如果您担心存储库的可用性,则应建立具有数量众多的服务器的HA环境,并相互复制和备份.

If you are worried about the availability of your repository, you should establish HA environment with number of servers, replicated and backed up one by another.

如果要切换环境,并且一旦处于不同的环境中,则无法再访问来自另一个Intranet的二进制存储库,则需要切换使用新环境中可用的二进制存储库,方法是使用不同的配置文件.将包含不同的服务器网址(或者可能只是访问原始服务器的代理).

If you are switching the environments and once you're in different environment the binary repository from the other intranet is not accessible anymore, you need to switch working with binary repository which is available in the new environment by using different profile, which will include different server urls (or maybe just a proxy to access the original server).

无论如何-用二进制存储库为Maven Central着色,不要将其用作备份.

Anyhow - shade the maven central with your binary repository and don't use it as a backup.

这篇关于Maven Intranet存储库故障转移重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆