简体   繁体   English

如何管理 git 中 maven 存储库的弃用?

[英]How can I manage the deprecation of a maven repository in git?

My company has many Java projects that use maven as its primary dependency management tool.我公司有许多 Java 项目使用 maven 作为其主要的依赖管理工具。 We write a number of our own dependencies (common functionality libraries relevant to my company's needs) which then need to be hosted in a maven repository so that our applications can download them as a dependency.我们编写了许多自己的依赖项(与我公司需求相关的通用功能库),然后需要将它们托管在 Maven 存储库中,以便我们的应用程序可以将它们作为依赖项下载。 Our own dependencies, however, are not exposed to the world;然而,我们自己的依赖并不暴露于世界; we want to be the only ones who have access to these artifacts and so we host our artifacts in private repos.我们希望成为唯一可以访问这些工件的人,因此我们将我们的工件托管在私人存储库中。

For example, our POMs typically have the following repository block:例如,我们的 POM 通常具有以下repository块:

<repository>
    <id>artifactory</id>
    <!-- Note: not a real maven repo... :P -->
    <url>http://initech.artifactoryonline.com/initech/repo/</url>
    <snapshots>
        <updatePolicy>always</updatePolicy>
    </snapshots>
</repository>

So, ArtifactoryOnline.com hosts all of our private dependencies today.因此,ArtifactoryOnline.com 今天托管了我们所有的私有依赖项。 Oh, and we use git as our vcs, so this repository block is in the pom.xml from the beginning of time.哦,我们使用git作为我们的vcs,所以这个repository块从一开始就在pom.xml中。

Here's the problem: ArtifactoryOnline.com is going away in a few months time (replaced with JFrog.io) and there is nothing that my company can do to influence that decision.问题在于:ArtifactoryOnline.com 将在几个月后消失(被 JFrog.io 取代),我的公司无法影响该决定。 The owners of ArtifactoryOnline.com have issued a statement saying that attempts to fetch resources from their deprecated host will fail once that time comes. ArtifactoryOnline.com 的所有者发表声明说,一旦那个时间到来,从他们已弃用的主机中获取资源的尝试将失败。

This is a problem for us.这对我们来说是个问题。 We have tens of thousands of commits across a dozen projects that depend upon this deprecated repository.我们有十几个项目的数万次提交,这些项目依赖于这个已弃用的存储库。 These commits have been through a rigorous QA process and represent over a decade of hard work on behalf of my company.这些承诺已经通过了严格的质量保证流程,代表了我公司十多年来的辛勤工作。 Yet, once this change occurs and the deprecated host goes offline, all of those builds which at one point worked are going to suddenly break due to missing dependency links.然而,一旦发生这种变化并且弃用的主机离线,所有那些曾经工作过的构建都将由于缺少依赖链接而突然中断。 Anyone who wants to use an old build of our application code will need to create a new branch and re-write the repository tag!任何想要使用我们应用程序代码的旧版本的人都需要创建一个新分支并重新编写存储库标签! This is a big problem for us.这对我们来说是个大问题。 (Lord have mercy if you need to bisect to isolate an old bug.) (如果您需要一分为二以隔离旧虫子,请上帝保佑。)

How can/should we handle this?我们可以/应该如何处理这个问题? Is there a way to retroactively modify the pom deep in the past of our projects such that the replacement repository is visible to the full time-line of our git repos?有没有办法追溯修改我们项目过去深处的 pom,以便替换存储库对我们的 git 存储库的完整时间线可见?

You can always add a mirror to the repository.您始终可以向存储库添加镜像。 The way it was handled here . 这里的处理方式。 You can either add it to each pom.xml or add it to settings.xml .您可以将其添加到每个pom.xml或将其添加到settings.xml The default location of the latter is ~/.m2/settings.xml .后者的默认位置是~/.m2/settings.xml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM