如果公司Maven存储库处于脱机状态或关闭状态,如何使用Internet进行Maven构建? [英] How to use the internet for maven builds instead, if the corporate maven repository is offline or down?

查看:143
本文介绍了如果公司Maven存储库处于脱机状态或关闭状态,如何使用Internet进行Maven构建?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在POM中定义了一个公司存储库:

I have a corporate repository defined in my POM:

<distributionManagement>
    <repository>
        <id>central</id>
        <name>libs-release-local</name>
        <url>http://bi-pub.wgresorts.com:8081/artifactory/libs-release-local</url>
    </repository>
    <snapshotRepository>
        <id>snapshots</id>
        <name>libs-snapshot-local</name>
        <url>http://bi-pub.wgresorts.com:8081/artifactory/libs-snapshot-local</url>
        <uniqueVersion>false</uniqueVersion>
    </snapshotRepository>
</distributionManagement>

但是他们不断拔出插头并移动或重新启动该盒子,因此有时不可用.有没有办法告诉我的行家poms尝试并使用公司存储库,但是如果无法使用,请使用Internet?"我尝试在分发管理部分之外指定存储库和插件存储库无济于事.

But they keep unplugging and moving or rebooting that box, so sometimes it's not available. Is there a way to tell my maven poms "try and use the corporate repository, but if it's down use the internet?" I tried specifying the repository and plugin repository outside of the distribution management section to no avail.

任何人都可以提供指导吗?

May anyone offer guidance please?

在settings.xml中,我定义了一个镜像和一个本地存储库:

In settings.xml I have a mirror and a local repository defined:

<mirrors>
    <mirror>
        <mirrorOf>*</mirrorOf>
        <name>repo</name>
        <url>http://bi-pub.wgresorts.com:8081/artifactory/repo</url>
        <id>repo</id>
    </mirror>
</mirrors>

<localRepository>C:\apache-maven-3.1.1\.m2\repository</localRepository>

我不想根据IT部门的异想天开更改settings.xml,我是否可以对其进行设置,以便它能够在企业宕机时尝试企业网络访问?

I don't want to have to keep changing the settings.xml depending on the whims of the IT department, can I set it up so it tries the corporate one goes to the internet if it's down?

编辑

如果使用id Central,则必须先创建一个带有Central的Pom,该Pom指向Internet上的真实Pom,然后才能对其进行修复.它还可以指向您的公司存储库,但具有不同的ID.然后,如果您的公司存储库已关闭,它将落到Internet上.

If you used the id central, you'll have to first create a pom with central that points to the real one on the internet before you can fix this. It can also point to your corporate repository but with a different ID. Then it will fall over to the internet if your corporate repository is down.

我认为您可能还必须从settings.xml中删除镜像部分

I think you may also have to delete the mirror section from the settings.xml

推荐答案

不管是好是坏,二进制存储库是生产管道中的关键部分. 您不会问如果我的站点关闭了,我有什么选择",对吗?您只需保持网站状态.同样的故事,您的IT部门应该意识到这一点.

For better or worse, binary repository is a critical piece of the production pipeline. You don't ask "what options do I have if my site is down", do you? You just keep your site up. Same story here, your IT department should realize that.

您可以在DR模式(主动/被动)或什至在HA模式(主动/主动)下运行Artifactory.您的存储库具有保持24/7全天候运行的所有能力,因此您实际上不需要这些解决方法.

You can run Artifactory in DR mode (active/passive) or even in HA mode (active/active). Your repository has all the means to stay up 24/7, so you really don't need those workarounds.

这篇关于如果公司Maven存储库处于脱机状态或关闭状态,如何使用Internet进行Maven构建?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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